diff options
author | Karl Berry <karl@freefriends.org> | 2021-01-19 22:58:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-01-19 22:58:18 +0000 |
commit | d90920fcea354385cda2c06cb25a7e490a1f66c7 (patch) | |
tree | c1894591bf30b94bf1fa75f28ed120b9f2d82c3f /Master/texmf-dist/tex/generic/circuitikz | |
parent | fdd73d8d37055fc18e84ba6e0f87b8d5bb359ed7 (diff) |
circuitikz (19jan21)
git-svn-id: svn://tug.org/texlive/trunk@57469 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz')
13 files changed, 6228 insertions, 6227 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index 0ed0d2b5860..b22da300eff 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -12,6 +12,17 @@ % % This file has folding marks for vim (See last line). % + +% +% This file is loaded *before* the options for the package are executed, mainly +% for the following three ifs +% +% these three ifs are fundamental for the package loading options; +% do not move away +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circ@siunitx@res +\newif\ifpgf@circuit@compat + %% Key managements%<<<1 \long\def\pgf@circ@comment#1{} @@ -221,6 +232,228 @@ }% %>>> +%% Generic macro for defining a bipole shape%<<< +% #1 - additional anchors +% #2 - lower y-size of the bipole (from the center). +% #3 - #shape is the name of the shape +% #4 - upper y-size of the bipole (from the center) +% #5 - width of the bipole +% #6 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipole{% + \pgfcircdeclarebipolescaled{default}} + +%% Generic macro for defining a bipole shape +% #1 - scale factor +% #2 - additional anchors +% #3 - lower y-size of the bipole (from the center). +% #4 - #shape is the name of the shape +% #5 - upper y-size of the bipole (from the center) +% #6 - width of the bipole +% #7 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{ + \pgfdeclareshape{#4shape}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\northeast}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\northeastborder}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwestborder}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=-#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwest}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\centerpoint}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen + \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen + \pgfpointorigin + \pgf@y=\pgf@circ@res@up + \advance\pgf@y by\pgf@circ@res@down + \pgf@y=.5\pgf@y + } + \anchor{center}{\pgfpointorigin} + \anchor{n}{ + \northeast + \pgf@x=0cm + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{ne}{ + \northeast + } + \anchor{nw}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{e}{ + \northeast + \pgf@y=0cm + } + \anchor{s}{ + \southwest + \pgf@x=0cm + } + \anchor{south east}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \southwest + } + \anchor{se}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{sw}{ + \southwest + } + \anchor{w}{ + \southwest + \pgf@y=0cm + } + \anchor{north}{ + \northeast + \pgf@x=0cm + } + \anchor{east}{ + \northeast + \pgf@y=0cm + } + \anchor{south}{ + \southwest + \pgf@x=0cm + } + \anchor{west}{ + \southwest + \pgf@y=0cm + } + \anchor{right}{ + \northeast + \pgf@y=0cm + } + \anchor{above}{ + \northeast + \pgf@x=0cm + } + \anchor{left}{ + \southwest + \pgf@y=0cm + } + \anchor{below}{ + \southwest + \pgf@x=0cm + } + \anchor{a}{ + \northeast + \pgf@y=0cm + } + \anchor{b}{ + \southwest + \pgf@y=0cm + } + \savedanchor{\textanchor}{% + \pgf@y=\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \anchor{text}{ + \textanchor + } + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } + + #2 + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@zero = 0cm + \pgf@circ@res@left = -\pgf@x + \pgf@circ@res@right = \pgf@x + \southwest + \pgf@circ@res@down = \pgf@y + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfstartlinewidth=\pgflinewidth + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + #7 + + \pgfsetlinewidth{\pgfstartlinewidth} + } + } +}% %>>> + +%% anchor adjustment macros%<<< + +% Extend the border anchor position by the specified factors on the right-top (north east corner) +% and the left-down (southwest border). Argument must be number (possibly decimal) without sign + +\def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \northeastborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}} + \fi + } +} + +% Just up and down (very common) +\def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}}% %>>> + % text position in some component.%<<<1 % (added with ieeestd logic ports. Maybe to be extended to other components, % like amplifiers) @@ -237,8 +470,6 @@ % voltage direction options%<<<1 -\newif\ifpgf@circ@siunitx -\newif\ifpgf@circuit@compat \newif\ifpgf@circ@oldvoltagedirection % default false \newif\ifpgf@circ@explicitvdir \newif\ifpgf@circ@fixbatteries @@ -324,8 +555,6 @@ \ctikzset{bipole/annotation/unit/.initial=} \ctikzset{bipole/annotation/name/.initial=} -\newif\ifpgf@circ@siunitx -\newif\ifpgf@circ@siunitx@res \ctikzset{label/align/.is choice} \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}} @@ -477,1671 +706,6 @@ \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}} %%>>> -% grounds and power supplies%<<<1 - -\ctikzset{monopoles/.is family} -\ctikzset{monopoles/ground/width/.initial=.25} -\ctikzset{monopoles/ground/connectionthickness/.initial=1} -\ctikzset{monopoles/ground/thickness/.initial=2} -\ctikzset{monopoles/rground/thickness/.initial=2} -\ctikzset{monopoles/tground/thickness/.initial=3} -\ctikzset{monopoles/vcc/width/.initial=.2} -\ctikzset{monopoles/vcc/arrow/.initial=legacy} -\ctikzset{monopoles/vee/arrow/.initial=legacy} -\ctikzset{monopoles/match/width/.initial=.4} -\ctikzset{monopoles/chassis/width/.initial=.25} -\ctikzset{monopoles/alternative chassis/width/.initial=.25} -\ctikzset{monopoles/equipotentiality/width/.initial=.25} -\ctikzset{monopoles/antenna/width/.initial=.25} -\ctikzset{monopoles/antenna/label/xanchor/.initial=.4} -\ctikzset{monopoles/antenna/label/yanchor/.initial=.75} -\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4} -\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75} -\ctikzset{monopoles/txantenna/width/.initial=.25} -\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4} -\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75} -\ctikzset{monopoles/rxantenna/width/.initial=.25} -\ctikzset{monopoles/bareantenna/width/.initial=.25} -\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1} -\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5} -\ctikzset{monopoles/waves/width/.initial=0.5}% -%>>> - -% microstrips %<<<1 -\ctikzset{bipoles/mstline/height/.initial=0.3} -\ctikzset{bipoles/mstline/width/.initial=1.2} -\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}} -\ctikzset{monopoles/msport/width/.initial=.5} -\ctikzset{monopoles/msrstub/height/.initial=1.0} -\ctikzset{monopoles/msrstub/width/.initial=0.6}% -%>>> - -% microphone and loudspeaker%<<<1 -\ctikzset{bipoles/loudspeaker/height/.initial=.8} -\ctikzset{bipoles/loudspeaker/depth/.initial=.3} -\ctikzset{bipoles/loudspeaker/width/.initial=.8} -\ctikzset{bipoles/mic/height/.initial=1.2} -\ctikzset{bipoles/mic/depth/.initial=.1} -\ctikzset{bipoles/mic/width/.initial=.8}% -%>>> - -% resistors%<<<1 -% Zig Zag resistors -\ctikzset{resistors/zigs/.initial=3} -\ctikzset{resistors/width/.code={% - \ctikzset{bipoles/resistor/width=#1}% - \ctikzset{bipoles/vresistor/width=#1}% - \ctikzset{bipoles/potentiometer/width=#1}% - \ctikzset{bipoles/resistivesens/width=#1}% - \ctikzset{bipoles/photoresistor/width=#1}% - \ctikzset{bipoles/thermistor/width=#1}% - \ctikzset{bipoles/thermistorntc/width=#1}% - \ctikzset{bipoles/thermistorptc/width=#1}% - \ctikzset{bipoles/varistor/width=#1}% - \ctikzset{bipoles/generic/width=#1}% - \ctikzset{bipoles/generic potentiometer/width=#1}% - \ctikzset{bipoles/ageneric/width=#1}% - \ctikzset{bipoles/tgeneric/width=#1}% -}} -\ctikzset{wiper pos/.code={% - \ctikzset{bipoles/potentiometer/wiper pos=#1}% - \ctikzset{bipoles/generic potentiometer/wiper pos=#1}% -}} -% zigzag resistor -\ctikzset{bipoles/resistor/height/.initial=.3} -\ctikzset{bipoles/resistor/width/.initial=.8} -\ctikzset{bipoles/potentiometer/height/.initial=.8} -\ctikzset{bipoles/potentiometer/height 2/.initial=.3} -\ctikzset{bipoles/potentiometer/width/.initial=.8} -\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5} -\ctikzset{bipoles/vresistor/height/.initial=.6} -\ctikzset{bipoles/vresistor/width/.initial=.8} -\ctikzset{bipoles/resistivesens/height/.initial=.6} -\ctikzset{bipoles/resistivesens/width/.initial=.8} -% square resistors -\ctikzset{bipoles/photoresistor/height/.initial=.6} -\ctikzset{bipoles/photoresistor/height 2/.initial=.3} -\ctikzset{bipoles/photoresistor/width/.initial=.8} -\ctikzset{bipoles/thermistor/main/.initial=.7} -\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7 -\ctikzset{bipoles/thermistorntc/width/.initial=.8} -\ctikzset{bipoles/thermistorntc/main/.initial=.7} -\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7 -\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7 -\ctikzset{bipoles/thermistorptc/width/.initial=.8} -\ctikzset{bipoles/thermistorptc/main/.initial=.7} -\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7 -\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7 -\ctikzset{bipoles/thermistor/width/.initial=.8} -\ctikzset{bipoles/varistor/main/.initial=.7} -\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7 -\ctikzset{bipoles/varistor/width/.initial=.8} -\ctikzset{bipoles/generic/height/.initial=.30} -\ctikzset{bipoles/generic/width/.initial=.80} -\ctikzset{bipoles/generic potentiometer/height/.initial=.80} -\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} -\ctikzset{bipoles/generic potentiometer/width/.initial=.80} -\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5} -\ctikzset{bipoles/ageneric/height/.initial=.30} -\ctikzset{bipoles/tgeneric/height/.initial=.70} -\ctikzset{bipoles/tgeneric/width/.initial=.80} -\ctikzset{bipoles/ageneric/width/.initial=.80} -\ctikzset{bipoles/memristor/height/.initial=.30} -\ctikzset{bipoles/memristor/wave height/.initial=.5} -\ctikzset{bipoles/memristor/width/.initial=.80} - -\newif\ifpgf@circuit@europeanresistor -\ctikzset{resistor/.is choice} -\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } -\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue } -\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} -\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}} -%%>>> - -%% Capacitors%<<<1 -\ctikzset{bipoles/capacitor/height/.initial=.6} -\ctikzset{bipoles/capacitor/width/.initial=.2} -\ctikzset{bipoles/ecapacitor/height/.initial=.5} -\ctikzset{bipoles/ecapacitor/width/.initial=.2} -\ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm} -%%% pcapacitor is deprecated -\ctikzset{bipoles/pcapacitor/height/.initial=.6} -\ctikzset{bipoles/pcapacitor/width/.initial=.2} -\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} -\ctikzset{bipoles/ccapacitor/height/.initial=.6} -\ctikzset{bipoles/ccapacitor/width/.initial=.12} -\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1} -\ctikzset{bipoles/vcapacitor/height/.initial=.6} -\ctikzset{bipoles/vcapacitor/width/.initial=.5} -\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} -\ctikzset{bipoles/piezoelectric/height/.initial=.7} -\ctikzset{bipoles/piezoelectric/width/.initial=.5}% -%>>> - -% Inductors%<<<1 -\ctikzset{inductors/coils/.code={% - \ctikzset{bipoles/cuteinductor/coils=#1}% - \ctikzset{bipoles/cutechoke/coils=#1}% - \ctikzset{bipoles/americaninductor/coils=#1}% - \ctikzset{bipoles/vcuteinductor/coils=#1}% - \ctikzset{bipoles/vamericaninductor/coils=#1}% -}} -\ctikzset{inductors/width/.code={% - \ctikzset{bipoles/cuteinductor/width=#1}% - \ctikzset{bipoles/cutechoke/width=#1}% - \ctikzset{bipoles/americaninductor/width=#1}% - \ctikzset{bipoles/vcuteinductor/width=#1}% - \ctikzset{bipoles/vamericaninductor/width=#1}% - \ctikzset{bipoles/fullgeneric/width=#1}% - \ctikzset{bipoles/tfullgeneric/width=#1}% -}} -\ctikzset{bipoles/cuteinductor/height/.initial=.3} -\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15} -\ctikzset{bipoles/cuteinductor/width/.initial=.6} -\ctikzset{bipoles/cuteinductor/coils/.initial=5} -\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil -%% Cute choke settings -\ctikzset{bipoles/cutechoke/height/.initial=.3} -\ctikzset{bipoles/cutechoke/lower coil height/.initial=.15} -\ctikzset{bipoles/cutechoke/width/.initial=.6} -\ctikzset{bipoles/cutechoke/coils/.initial=5} -\ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil -\ctikzset{bipoles/cutechoke/cstep/.initial=.3} -\ctikzset{bipoles/cutechoke/cdist/.initial=1.3} -\ctikzset{bipoles/cutechoke/cthick/.initial=1} -\newif\ifpgf@circuit@bipole@twolineschoke -\pgf@circuit@bipole@twolineschokefalse -\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} -\ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} -\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} -\ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} -% -\ctikzset{bipoles/americaninductor/height/.initial=.3} -\ctikzset{bipoles/americaninductor/height 2/.initial=.1} -\ctikzset{bipoles/americaninductor/width/.initial=.8} -\ctikzset{bipoles/americaninductor/coils/.initial=4} -\ctikzset{bipoles/americaninductor/coil height/.initial=.15} -\ctikzset{bipoles/vcuteinductor/height/.initial=.6} -\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3} -\ctikzset{bipoles/vcuteinductor/width/.initial=.6} -\ctikzset{bipoles/vcuteinductor/coils/.initial=5} -\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil -\ctikzset{bipoles/vamericaninductor/height/.initial=.6} -\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2} -\ctikzset{bipoles/vamericaninductor/width/.initial=.8} -\ctikzset{bipoles/vamericaninductor/coils/.initial=4} -\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15} -\ctikzset{bipoles/tfullgeneric/height/.initial=.70} -\ctikzset{bipoles/tfullgeneric/width/.initial=.80} -\ctikzset{bipoles/fullgeneric/height/.initial=.30} -\ctikzset{bipoles/fullgeneric/width/.initial=.80} -\ctikzset{inductor/.is choice} -\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}} -\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}} -\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}} - -\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}} -\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}} -\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}} -\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}} -\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}} - -%%>>> - -% Sources%<<<1 - -\ctikzset{bipoles/esource/height/.initial=.60} -\ctikzset{bipoles/esource/width/.initial=.60} -\ctikzset{bipoles/pvsource/height/.initial=.60} -\ctikzset{bipoles/pvsource/width/.initial=.60} -\ctikzset{bipoles/isource/height/.initial=.60} -\ctikzset{bipoles/isource/width/.initial=.60} -\ctikzset{bipoles/oosource/height/.initial=.60} -\ctikzset{bipoles/oosource/width/.initial=.60} -\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/dcisource/angle/.initial=80} -\ctikzset{bipoles/dcisource/height/.initial=.60} -\ctikzset{bipoles/dcisource/width/.initial=.60} -\ctikzset{bipoles/dcvsource/height/.initial=.60} -\ctikzset{bipoles/dcvsource/width/.initial=.60} -\ctikzset{bipoles/vsourcetri/height/.initial=.60} -\ctikzset{bipoles/vsourcetri/width/.initial=.60} -\ctikzset{bipoles/isourceam/height/.initial=.60} -\ctikzset{bipoles/isourceam/width/.initial=.60} -\ctikzset{bipoles/vsource/height/.initial=.60} -\ctikzset{bipoles/vsource/width/.initial=.60} -\ctikzset{bipoles/vsourceam/height/.initial=.60} -\ctikzset{bipoles/vsourceam/width/.initial=.60} -\ctikzset{bipoles/vsourceam/margin/.initial=.7} -\ctikzset{bipoles/isourcesin/height/.initial=.60} -\ctikzset{bipoles/isourcesin/width/.initial=.60} -\ctikzset{bipoles/vsourcesin/height/.initial=.60} -\ctikzset{bipoles/vsourcesin/width/.initial=.60} -\ctikzset{bipoles/vsourcesquare/height/.initial=.60} -\ctikzset{bipoles/vsourcesquare/width/.initial=.60} -\ctikzset{bipoles/cisource/height/.initial=.7} -\ctikzset{bipoles/cisource/width/.initial=.7} -\ctikzset{bipoles/cisourceam/height/.initial=.7} -\ctikzset{bipoles/cisourceam/width/.initial=.7} -\ctikzset{bipoles/ecsource/height/.initial=.7} -\ctikzset{bipoles/ecsource/width/.initial=.7} -\ctikzset{bipoles/cvsource/height/.initial=.7} -\ctikzset{bipoles/cvsource/width/.initial=.7} -\ctikzset{bipoles/cvsourceam/height/.initial=.7} -\ctikzset{bipoles/cvsourceam/width/.initial=.7} -\ctikzset{bipoles/cvsourceam/margin/.initial=.7} -\ctikzset{bipoles/cvsourceam/text scale/.initial=1} -\ctikzset{bipoles/cisourcesin/width/.initial=.7} -\ctikzset{bipoles/cvsourcesin/height/.initial=.7} -\ctikzset{bipoles/cvsourcesin/width/.initial=.7} -\ctikzset{bipoles/battery/height/.initial=.6} -\ctikzset{bipoles/battery/width/.initial=.3} -\ctikzset{bipoles/battery1/height/.initial=.6} -\ctikzset{bipoles/battery1/width/.initial=.3} -\ctikzset{bipoles/battery2/height/.initial=.6} -\ctikzset{bipoles/battery2/width/.initial=.3} -% noise sources -\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} - -%%>>> - -% "oo" style transformers and power grid diagrams%<<<1 -% % % ootransformer -\ctikzset{bipoles/oosourcetrans/height/.initial=.6} -\ctikzset{bipoles/oosourcetrans/width/.initial=.6} -\ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1} - -% % % oootransformer -\ctikzset{bipoles/ooosource/height/.initial=.6} -\ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1} - -% % % primary windings -\newif\ifpgf@circ@prim@delta -\newif\ifpgf@circ@prim@wye -\newif\ifpgf@circ@prim@zig -\pgfkeys{tikz/prim/.is choice} -\pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}} -\pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}} -\pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}} - -% % % secondary windings -\newif\ifpgf@circ@sec@delta -\newif\ifpgf@circ@sec@wye -\newif\ifpgf@circ@sec@zig -\pgfkeys{tikz/sec/.is choice} -\pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}} -\pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}} -\pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}} - -% % % tertiary windings (ooosource) -\newif\ifpgf@circ@tert@delta -\newif\ifpgf@circ@tert@wye -\newif\ifpgf@circ@tert@zig -\pgfkeys{tikz/tert/.is choice} -\pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}} -\pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}} -\pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}% -%>>> - -% diodes%<<<1 - -\ctikzset{bipoles/diode/height/.initial=.50} -\ctikzset{bipoles/diode/width/.initial=.40} -\ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} -\ctikzset{bipoles/bidirectionaldiode/width/.initial=1} -\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3} -\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} -\ctikzset{bipoles/varcap/height/.initial=.50} -\ctikzset{bipoles/varcap/width/.initial=.45} -\ctikzset{tripoles/thyristor/height/.initial=1.10} -\ctikzset{tripoles/thyristor/height 2/.initial=.5} -\ctikzset{tripoles/thyristor/width/.initial=1.0} -\ctikzset{tripoles/thyristor/diode height/.initial=.5} -\ctikzset{tripoles/thyristor/diode width left/.initial=.4} -\ctikzset{tripoles/thyristor/diode width right/.initial=.3} - -\ctikzset{tripoles/triac/height/.initial=1.1} -\ctikzset{tripoles/triac/width/.initial=1} -\ctikzset{tripoles/triac/diode width left/.initial=.3} -\ctikzset{tripoles/triac/diode width right/.initial=.3} -% -% Flipping arrows in LED and photodiodes -% -\newif\ifpgf@led@fliparrows -\newif\ifpgf@pd@fliparrows -\pgf@led@fliparrowsfalse -\pgf@pd@fliparrowsfalse -% -% by default the arrows start (LED) and go (PD) to the anode. -% -\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} -\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} -% -% but they can start form the cathode (LED) or go to it (PD) -% -\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} -\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} - -\newif\ifpgf@circuit@strokediode -\newif\ifpgf@circuit@fulldiode -\pgf@circuit@strokediodefalse -\pgf@circuit@fulldiodefalse - -\ctikzset{diode/.is choice} -\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default -\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } -\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} - -\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}} -\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}} -\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}} - -%%>>> - -% switches%<<<1 - -\ctikzset{bipoles/spst/height/.initial=.35} -\ctikzset{bipoles/spst/width/.initial=.35} -\ctikzset{bipoles/spst/depth/.initial=.2} -\ctikzset{bipoles/nos/height/.initial=.3} -\ctikzset{bipoles/nos/width/.initial=.35} -\ctikzset{bipoles/nos/depth/.initial=.2} -\ctikzset{bipoles/ncs/height/.initial=.35} -\ctikzset{bipoles/ncs/width/.initial=.35} -\ctikzset{bipoles/ncs/depth/.initial=.2} -\ctikzset{bipoles/pushbutton/height/.initial=.5} -\ctikzset{bipoles/pushbutton/height 2/.initial=.2} -\ctikzset{bipoles/pushbutton/width/.initial=.50} -%%% reed switch -\ctikzset{bipoles/reed/height/.initial=.4} -\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos -\ctikzset{bipoles/reed/depth/.initial=.4} -%% Cute switches -\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}} -\ctikzset{bipoles/cuteswitch/height/.initial=.6} -\ctikzset{bipoles/cuteswitch/height 2/.initial=.2} -\ctikzset{bipoles/cuteswitch/width/.initial=.50} -\ctikzset{bipoles/cuteswitch/thickness/.initial=1} - -\ctikzset{tripoles/spdt/width/.initial=.85} -\ctikzset{tripoles/spdt/height/.initial=.45} -\ctikzset{tripoles/spdt/margin/.initial=.45} - -\ctikzset{tripoles/toggleswitch/height/.initial=.8} -\ctikzset{tripoles/toggleswitch/height 2/.initial=.0} -\ctikzset{tripoles/toggleswitch/width/.initial=.80} -%%>>> - -% arresters, fuses, lamps, etc%<<<1 - -\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} -\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} -\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30} -\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60} -\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60} -\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15} -\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25} -\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45} -\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1} -\ctikzset{bipoles/fuse/height/.initial=.20} -\ctikzset{bipoles/fuse/width/.initial=.50} -\ctikzset{bipoles/afuse/height/.initial=.20} -\ctikzset{bipoles/afuse/width/.initial=.50} -\ctikzset{bipoles/lamp/height/.initial=.60} -\ctikzset{bipoles/lamp/width/.initial=.60} -\ctikzset{bipoles/bulb/height/.initial=.8} -\ctikzset{bipoles/bulb/width/.initial=.8} -\ctikzset{bipoles/tline/height/.initial=.3} -\ctikzset{bipoles/tline/width/.initial=.6} -\ctikzset{bipoles/squid/height/.initial=.60} -\ctikzset{bipoles/squid/width/.initial=.60} -\ctikzset{bipoles/barrier/height/.initial=.60} -\ctikzset{bipoles/barrier/width/.initial=.60} -\ctikzset{bipoles/openbarrier/gap/.initial=0.5} -\ctikzset{bipoles/thermocouple/height/.initial=.250} -\ctikzset{bipoles/thermocouple/height 2/.initial=.60} -\ctikzset{bipoles/thermocouple/width/.initial=.140} -\newif\ifpgf@circuit@europeangfsurgearrester -\ctikzset{gas filled surge arrester choice/.is choice} -\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}} -\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}} - -\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}} -\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}} -%%>>> - -% wires (open, shorts, ...)%<<<1 - -\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages -\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages -\ctikzset{bipoles/open/voltage/straight label distance/.initial=0} -\ctikzset{bipoles/open/voltage/distance from node/.initial=.2} -\ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning -\ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning -% multiwire -\ctikzset{bipoles/multiwire/height/.initial=0.4} -\ctikzset{bipoles/multiwire/width/.initial=0.2} -\ctikzset{bipoles/multiwire/spacing/.initial=0.05} -% crossing wires -\ctikzset{bipoles/crossing/size/.initial=.2} -%%>>> - -% Instruments %<<<1 -\ctikzset{bipoles/ammeter/height/.initial=.60} -\ctikzset{bipoles/ammeter/width/.initial=.60} -\ctikzset{bipoles/ohmmeter/height/.initial=.60} -\ctikzset{bipoles/ohmmeter/width/.initial=.60} -\ctikzset{bipoles/voltmeter/height/.initial=.60} -\ctikzset{bipoles/voltmeter/width/.initial=.60} -\ctikzset{bipoles/smeter/height/.initial=.60} -\ctikzset{bipoles/smeter/width/.initial=.60} -\ctikzset{bipoles/smeter/voltage/additional shift/.initial=1} -\ctikzset{bipoles/qmeter/depth/.initial=.40} -\ctikzset{bipoles/qmeter/height/.initial=.80} -\ctikzset{bipoles/qmeter/width/.initial=.60} -% this must be specified for each one -\ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5} -\ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5} -\ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5} -\ctikzset{bipoles/iloop/width/.initial=.40} -\ctikzset{bipoles/iloop/height/.initial=.60} - -\ctikzset{bipoles/oscope/height/.initial=.60} -\ctikzset{bipoles/oscope/width/.initial=.60} -\ctikzset{bipoles/oscope/voltage/additional shift/.initial=1} - - -% option to not rotate the new (Romano's) instruments -\newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue -\pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} -\ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} -\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} -\ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} -%%>>> - -% blocks (twoports and so)%<<<1 - -\ctikzset{bipoles/twoport/width/.initial=.7} -\ctikzset{bipoles/twoport/height/.initial=.7} -\ctikzset{bipoles/twoport/text/.initial=} -\ctikzset{bipoles/twoportsplit/width/.initial=.7} -\ctikzset{bipoles/twoport/text in/.initial=} -\ctikzset{bipoles/twoport/text out/.initial=} -\ctikzset{text/.style={t=#1}} -\ctikzset{t/.code={% - \ctikzsetvalof{bipoles/twoport/text}{#1}% -}} -\ctikzset{text in/.style={t1=#1}} -\ctikzset{t1/.code={% - \ctikzsetvalof{bipoles/twoport/text in}{#1}% -}} -\ctikzset{text out/.style={t2=#1}} -\ctikzset{t2/.code={% - \ctikzsetvalof{bipoles/twoport/text out}{#1}% -}} -\ctikzset{bipoles/vco/width/.initial=.7} -\ctikzset{bipoles/bandpass/width/.initial=.7} -\ctikzset{bipoles/bandstop/width/.initial=.7} -\ctikzset{bipoles/highpass/width/.initial=.7} -\ctikzset{bipoles/lowpass/width/.initial=.7} -\ctikzset{bipoles/allpass/width/.initial=.7} -\ctikzset{bipoles/adc/width/.initial=.7} -\ctikzset{bipoles/dac/width/.initial=.7} -\ctikzset{bipoles/dsp/width/.initial=.7} -\ctikzset{bipoles/fft/width/.initial=.7} -\ctikzset{bipoles/amp/width/.initial=.7} -\ctikzset{bipoles/vamp/width/.initial=.7} -\ctikzset{bipoles/piattenuator/width/.initial=.7} -\ctikzset{bipoles/vpiattenuator/width/.initial=.7} -\ctikzset{bipoles/tattenuator/width/.initial=.7} -\ctikzset{bipoles/vtattenuator/width/.initial=.7} -\ctikzset{bipoles/phaseshifter/width/.initial=.7} -\ctikzset{bipoles/vphaseshifter/width/.initial=.7} -\ctikzset{bipoles/detector/width/.initial=.7} -\ctikzset{tripoles/mixer/width/.initial=0.7} -\ctikzset{tripoles/adder/width/.initial=0.7} -\ctikzset{tripoles/circulator/width/.initial=.7} -\ctikzset{tripoles/oscillator/width/.initial=.7} - -\ctikzset{tripoles/wilkinson/height/.initial=1.3} -\ctikzset{tripoles/wilkinson/width/.initial=1.3} - -\ctikzset{tripoles/splitter/height/.initial=1.3} -\ctikzset{tripoles/splitter/width/.initial=1.3} - -\ctikzset{tripoles/mzm/height/.initial=1.3} -\ctikzset{tripoles/mzm/width/.initial=1.3} -%%>>> - -% Transistors %<<<1 - -\newif\ifpgf@circuit@trans@depletiontype -\pgf@circuit@trans@depletiontypefalse - -\newif\ifpgf@circuit@mos@arrows -\ctikzset{tripoles/mos style/.is choice} -\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} -\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} -\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} -\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} - -% Fixed label positions -\newif\ifpgf@circuit@transisors@fixlabels -\pgf@circuit@transisors@fixlabelstrue -\pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} -\ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} -\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} -\ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} - -% Option solderdot for fet -\newif\ifpgf@circuit@fet@solderdot -\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} -\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} -\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} -\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} - -% Option bodydiode for fet -\newif\ifpgf@circuit@fet@bodydiode -\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} -\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} -\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} -\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} - -% Option draw fet without gate connection -\newif\ifpgf@circuit@bpt@drawgate -\pgf@circuit@bpt@drawgatetrue -\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} -\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} -\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} -\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} - -% Option draw bpt with schottky base -\newif\ifpgf@circuit@bpt@schottky -\pgf@circuit@bpt@schottkyfalse -\pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} -\ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} -\pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} -\ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} -\ctikzset{tripoles/schottky base size/.initial=0.05} - -% Option draw bpt without base connection -\newif\ifpgf@circuit@bpt@drawbase -\pgf@circuit@bpt@drawbasetrue -\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} -\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} -\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} -\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} - -% Option draw bpt with optical input -\newif\ifpgf@circuit@bpt@drawphoto -\pgf@circuit@bpt@drawphotofalse -\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} -\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} -\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} -\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} - -% Option draw fet without bulk connection -- Added by Burak Kelleci -\newif\ifpgf@circuit@bpt@drawbulk -\pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} -\ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} -\pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} -\ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} - -% Option draw pmos with empty circle -\newif\ifpgf@circuit@pmos@emptycircle -\pgf@circuit@pmos@emptycirclefalse -\ctikzset{tripoles/pmos style/.is choice} -\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} -\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} -% Option draw pmos with no circle -\newif\ifpgf@circuit@pmos@nocircle -\pgf@circuit@pmos@nocirclefalse -\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} -\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} -% back to normal -\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} -\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} -% arrows at the end, the correct way -\newif\ifpgf@circuit@trans@arrowatend -\pgf@circuit@trans@arrowatendfalse -\ctikzset{transistors/arrow pos/.is choice} -\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} -\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} - -\newif\ifpgf@circuit@trans@ntype -\pgf@circuit@trans@ntypetrue %default true -%\newif\ifpgf@circuit@trans@ptype -%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}} -\ctikzset{tripoles/nmos/width/.initial=.7} -\ctikzset{tripoles/nmos/gate height/.initial=.35} -\ctikzset{tripoles/nmos/base height/.initial=.5} -\ctikzset{tripoles/nmos/conn height/.initial=0} -\ctikzset{tripoles/nmos/height/.initial=1.1} -\ctikzset{tripoles/nmos/base width/.initial=.5} -\ctikzset{tripoles/nmos/gate width/.initial=.62} -\ctikzset{tripoles/nmos/arrow pos/.initial=.6} -\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nmos/curr direction/.initial=1} - -\ctikzset{tripoles/pmos/width/.initial=.7} -\ctikzset{tripoles/pmos/gate height/.initial=.35} -\ctikzset{tripoles/pmos/base height/.initial=.5} -\ctikzset{tripoles/pmos/conn height/.initial=0} -\ctikzset{tripoles/pmos/height/.initial=1.1} -\ctikzset{tripoles/pmos/base width/.initial=.5} -\ctikzset{tripoles/pmos/gate width/.initial=.62} -\ctikzset{tripoles/pmos/arrow pos/.initial=.4} -\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pmos/curr direction/.initial=-1} - -\ctikzset{tripoles/nmosd/width/.initial=.7} -\ctikzset{tripoles/nmosd/gate height/.initial=.35} -\ctikzset{tripoles/nmosd/base height/.initial=.5} -\ctikzset{tripoles/nmosd/conn height/.initial=0} -\ctikzset{tripoles/nmosd/height/.initial=1.1} -\ctikzset{tripoles/nmosd/base width/.initial=.5} -\ctikzset{tripoles/nmosd/gate width/.initial=.62} -\ctikzset{tripoles/nmosd/arrow pos/.initial=.6} -\ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nmosd/curr direction/.initial=1} -\ctikzset{tripoles/nmosd/depletion width/.initial=.1} -\ctikzset{tripoles/nmosd/depletion color/.initial=default} - -\ctikzset{tripoles/pmosd/width/.initial=.7} -\ctikzset{tripoles/pmosd/gate height/.initial=.35} -\ctikzset{tripoles/pmosd/base height/.initial=.5} -\ctikzset{tripoles/pmosd/conn height/.initial=0} -\ctikzset{tripoles/pmosd/height/.initial=1.1} -\ctikzset{tripoles/pmosd/base width/.initial=.5} -\ctikzset{tripoles/pmosd/gate width/.initial=.62} -\ctikzset{tripoles/pmosd/arrow pos/.initial=.4} -\ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pmosd/curr direction/.initial=-1} -\ctikzset{tripoles/pmosd/depletion width/.initial=.1} -\ctikzset{tripoles/pmosd/depletion color/.initial=default} -\ctikzset{tripoles/hemt/width/.initial=.7} -\ctikzset{tripoles/hemt/gate height/.initial=.35} -\ctikzset{tripoles/hemt/base height/.initial=.5} -\ctikzset{tripoles/hemt/conn height/.initial=0} -\ctikzset{tripoles/hemt/height/.initial=1.1} -\ctikzset{tripoles/hemt/base width/.initial=.5} -\ctikzset{tripoles/hemt/gate width/.initial=.62} -\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/hemt/curr direction/.initial=1} - -\ctikzset{tripoles/nfet/width/.initial=.7} -\ctikzset{tripoles/nfet/gate height/.initial=.35} -\ctikzset{tripoles/nfet/base height/.initial=.5} -\ctikzset{tripoles/nfet/conn height/.initial=0} -\ctikzset{tripoles/nfet/height/.initial=1.1} -\ctikzset{tripoles/nfet/base width/.initial=.5} -\ctikzset{tripoles/nfet/gate width/.initial=.62} -\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nfet/curr direction/.initial=1} - -\ctikzset{tripoles/pfet/width/.initial=.7} -\ctikzset{tripoles/pfet/gate height/.initial=.35} -\ctikzset{tripoles/pfet/base height/.initial=.5} -\ctikzset{tripoles/pfet/conn height/.initial=0} -\ctikzset{tripoles/pfet/height/.initial=1.1} -\ctikzset{tripoles/pfet/base width/.initial=.5} -\ctikzset{tripoles/pfet/gate width/.initial=.62} -\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pfet/curr direction/.initial=-1} - -\ctikzset{tripoles/nfetd/width/.initial=.7} -\ctikzset{tripoles/nfetd/gate height/.initial=.35} -\ctikzset{tripoles/nfetd/base height/.initial=.5} -\ctikzset{tripoles/nfetd/conn height/.initial=0} -\ctikzset{tripoles/nfetd/height/.initial=1.1} -\ctikzset{tripoles/nfetd/base width/.initial=.5} -\ctikzset{tripoles/nfetd/gate width/.initial=.62} -\ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nfetd/curr direction/.initial=1} - -\ctikzset{tripoles/pfetd/width/.initial=.7} -\ctikzset{tripoles/pfetd/gate height/.initial=.35} -\ctikzset{tripoles/pfetd/base height/.initial=.5} -\ctikzset{tripoles/pfetd/conn height/.initial=0} -\ctikzset{tripoles/pfetd/height/.initial=1.1} -\ctikzset{tripoles/pfetd/base width/.initial=.5} -\ctikzset{tripoles/pfetd/gate width/.initial=.62} -\ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pfetd/curr direction/.initial=-1} - -\ctikzset{tripoles/nigfete/width/.initial=.7} -\ctikzset{tripoles/nigfete/gate height/.initial=.35} -\ctikzset{tripoles/nigfete/base height/.initial=.5} -\ctikzset{tripoles/nigfete/conn height/.initial=.35} -\ctikzset{tripoles/nigfete/height/.initial=1.1} -\ctikzset{tripoles/nigfete/base width/.initial=.5} -\ctikzset{tripoles/nigfete/gate width/.initial=.62} -\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nigfete/curr direction/.initial=1} - -\ctikzset{tripoles/nigfetd/width/.initial=.7} -\ctikzset{tripoles/nigfetd/gate height/.initial=.35} -\ctikzset{tripoles/nigfetd/base height/.initial=.5} -\ctikzset{tripoles/nigfetd/conn height/.initial=.35} -\ctikzset{tripoles/nigfetd/height/.initial=1.1} -\ctikzset{tripoles/nigfetd/base width/.initial=.5} -\ctikzset{tripoles/nigfetd/gate width/.initial=.62} -\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nigfetd/curr direction/.initial=1} - -\ctikzset{tripoles/nigfetebulk/width/.initial=.7} -\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35} -\ctikzset{tripoles/nigfetebulk/base height/.initial=.5} -\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35} -\ctikzset{tripoles/nigfetebulk/height/.initial=1.1} -\ctikzset{tripoles/nigfetebulk/base width/.initial=.5} -\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62} -\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1} - -\ctikzset{tripoles/pigfete/width/.initial=.7} -\ctikzset{tripoles/pigfete/gate height/.initial=.35} -\ctikzset{tripoles/pigfete/base height/.initial=.5} -\ctikzset{tripoles/pigfete/conn height/.initial=.35} -\ctikzset{tripoles/pigfete/height/.initial=1.1} -\ctikzset{tripoles/pigfete/base width/.initial=.5} -\ctikzset{tripoles/pigfete/gate width/.initial=.62} -\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pigfete/curr direction/.initial=-1} - -\ctikzset{tripoles/pigfetd/width/.initial=.7} -\ctikzset{tripoles/pigfetd/gate height/.initial=.35} -\ctikzset{tripoles/pigfetd/base height/.initial=.5} -\ctikzset{tripoles/pigfetd/conn height/.initial=.35} -\ctikzset{tripoles/pigfetd/height/.initial=1.1} -\ctikzset{tripoles/pigfetd/base width/.initial=.5} -\ctikzset{tripoles/pigfetd/gate width/.initial=.62} -\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pigfetd/curr direction/.initial=-1} - -\ctikzset{tripoles/pigfetebulk/width/.initial=.7} -\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35} -\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35} -\ctikzset{tripoles/pigfetebulk/base height/.initial=.5} -\ctikzset{tripoles/pigfetebulk/height/.initial=1.1} -\ctikzset{tripoles/pigfetebulk/base width/.initial=.5} -\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62} -\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1} - -\ctikzset{tripoles/npn/width/.initial=.6} -\ctikzset{tripoles/npn/base height/.initial=.45} -\ctikzset{tripoles/npn/base height 2/.initial=.15} -\ctikzset{tripoles/npn/base height/.initial=.4} -\ctikzset{tripoles/npn/conn height/.initial=0} -\ctikzset{tripoles/npn/height/.initial=1.1} -\ctikzset{tripoles/npn/base width/.initial=.5} -\ctikzset{tripoles/npn/arrow pos/.initial=.5} -\ctikzset{tripoles/npn/bodydiode scale/.initial=.3} -\ctikzset{tripoles/npn/bodydiode distance/.initial=.3} -\ctikzset{tripoles/npn/bodydiode conn/.initial=.6} -\ctikzset{tripoles/npn/curr direction/.initial=1} - -\ctikzset{tripoles/pnp/width/.initial=.6} -\ctikzset{tripoles/pnp/base height/.initial=.45} -\ctikzset{tripoles/pnp/base height 2/.initial=.15} -\ctikzset{tripoles/pnp/base height/.initial=.4} -\ctikzset{tripoles/pnp/conn height/.initial=0} -\ctikzset{tripoles/pnp/height/.initial=1.1} -\ctikzset{tripoles/pnp/base width/.initial=.5} -\ctikzset{tripoles/pnp/arrow pos/.initial=.5} -\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pnp/curr direction/.initial=-1} - -\ctikzset{tripoles/pigbt/width/.initial=.6} -\ctikzset{tripoles/pigbt/gate height/.initial=.45} -\ctikzset{tripoles/pigbt/gate height 2/.initial=.15} -\ctikzset{tripoles/pigbt/base height/.initial=.4} -\ctikzset{tripoles/pigbt/outer base height/.initial=.4} -\ctikzset{tripoles/pigbt/outer base thickness/.initial=1} -\ctikzset{tripoles/pigbt/conn height/.initial=0} -\ctikzset{tripoles/pigbt/height/.initial=1.1} -\ctikzset{tripoles/pigbt/gate width/.initial=.62} -\ctikzset{tripoles/pigbt/base width/.initial=.5} -\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pigbt/curr direction/.initial=-1} - -\ctikzset{tripoles/nigbt/width/.initial=.6} -\ctikzset{tripoles/nigbt/gate height/.initial=.45} -\ctikzset{tripoles/nigbt/gate height 2/.initial=.15} -\ctikzset{tripoles/nigbt/base height/.initial=.4} -\ctikzset{tripoles/nigbt/outer base height/.initial=.4} -\ctikzset{tripoles/nigbt/outer base thickness/.initial=1} -\ctikzset{tripoles/nigbt/conn height/.initial=0} -\ctikzset{tripoles/nigbt/height/.initial=1.1} -\ctikzset{tripoles/nigbt/gate width/.initial=.62} -\ctikzset{tripoles/nigbt/base width/.initial=.5} -\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nigbt/curr direction/.initial=1} - -\ctikzset{tripoles/Lpigbt/width/.initial=.6} -\ctikzset{tripoles/Lpigbt/gate height/.initial=.45} -\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15} -\ctikzset{tripoles/Lpigbt/base height/.initial=.4} -\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4} -\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1} -\ctikzset{tripoles/Lpigbt/conn height/.initial=.4} -\ctikzset{tripoles/Lpigbt/height/.initial=1.1} -\ctikzset{tripoles/Lpigbt/gate width/.initial=.62} -\ctikzset{tripoles/Lpigbt/base width/.initial=.5} -\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1} - -\ctikzset{tripoles/Lnigbt/width/.initial=.6} -\ctikzset{tripoles/Lnigbt/gate height/.initial=.45} -\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15} -\ctikzset{tripoles/Lnigbt/base height/.initial=.4} -\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4} -\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1} -\ctikzset{tripoles/Lnigbt/conn height/.initial=.4} -\ctikzset{tripoles/Lnigbt/height/.initial=1.1} -\ctikzset{tripoles/Lnigbt/gate width/.initial=.62} -\ctikzset{tripoles/Lnigbt/base width/.initial=.5} -\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/Lnigbt/curr direction/.initial=1} - -\ctikzset{tripoles/igbt/outer base height/.code={ - \ctikzset{tripoles/nigbt/outer base height/.initial=#1} - \ctikzset{tripoles/pigbt/outer base height/.initial=#1} - \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1} - \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1} - \ctikzset{tripoles/Lnigbt/conn height/.initial=#1} - \ctikzset{tripoles/Lpigbt/conn height/.initial=#1} -}} -\ctikzset{tripoles/igbt/outer base thickness/.code={ - \ctikzset{tripoles/nigbt/outer base thickness=#1} - \ctikzset{tripoles/pigbt/outer base thickness=#1} - \ctikzset{tripoles/Lnigbt/outer base thickness=#1} - \ctikzset{tripoles/Lpigbt/outer base thickness=#1} -}} - -\ctikzset{tripoles/njfet/width/.initial=.7} -\ctikzset{tripoles/njfet/gate height/.initial=.5} -\ctikzset{tripoles/njfet/gate height 2/.initial=.35} -\ctikzset{tripoles/njfet/gate width/.initial=.5} -\ctikzset{tripoles/njfet/conn height/.initial=.35} -\ctikzset{tripoles/njfet/height/.initial=1.1} -\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/njfet/curr direction/.initial=1} - -\ctikzset{tripoles/pjfet/width/.initial=.7} -\ctikzset{tripoles/pjfet/gate height/.initial=.5} -\ctikzset{tripoles/pjfet/gate height 2/.initial=.35} -\ctikzset{tripoles/pjfet/gate width/.initial=.5} -\ctikzset{tripoles/pjfet/conn height/.initial=.35} -\ctikzset{tripoles/pjfet/height/.initial=1.1} -\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pjfet/curr direction/.initial=-1} - -\ctikzset{tripoles/isfet/width/.initial=1} -\ctikzset{tripoles/isfet/gate height/.initial=.35} -\ctikzset{tripoles/isfet/base height/.initial=.5} -\ctikzset{tripoles/isfet/height/.initial=1.1} -\ctikzset{tripoles/isfet/base width/.initial=.3} -\ctikzset{tripoles/isfet/gate width/.initial=.5} -\ctikzset{tripoles/isfet/conn height/.initial=0} -\ctikzset{tripoles/isfet/wave width/.initial=.16} -\ctikzset{tripoles/isfet/wave amp/.initial=.06} -\ctikzset{tripoles/isfet/waves y sep/.initial=.22} -\ctikzset{tripoles/isfet/waves x sep/.initial=.8} -\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/isfet/curr direction/.initial=1} -% -% multi-emitter and multi-collector BJTs by Romano Giannetti -% -\ctikzset{tripoles/bjt/emitters/.initial=1} -\ctikzset{tripoles/bjt/collectors/.initial=1} -\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}} -\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}} -\ctikzset{tripoles/bjt/pins width/.initial=0.3} -\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}} -\ctikzset{tripoles/bjt/multi height/.initial=.5} -\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}} -% -\ctikzset{tripoles/bjt/width/.initial=.3} -\ctikzset{tripoles/bjt/base height 2/.initial=.4} -\ctikzset{tripoles/bjt/base height/.initial=1.1} -\ctikzset{tripoles/bjt/height/.initial=.4} -\ctikzset{tripoles/bjt/base width/.initial=1} -\ctikzset{tripoles/bjt/arrow pos/.initial=.5} -% do NOT touch these two! -\ctikzset{tripoles/bjt/npn/curr direction/.initial=1} -\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1} - -%% transistors stop here -%%>>> - -% Electronic tubes: diodetube, triode, tetrode and pentode%<<<1 -\ctikzset{tubes/width/.initial=1} % relative width -\ctikzset{tubes/height/.initial=1.4} % relative height -\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle -\ctikzset{tubes/anode distance/.initial=0.40} % distance from center -\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate -\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center -\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes -\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids -\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center -\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid -\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode -\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire -\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side -\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode -\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint - -\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse -\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} -\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} -\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse -\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} -\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} -\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse -\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} -\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}% -%>>> - -%% Logic ports%<<<1 -%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex - -% switches for logic gates -% -\pgfkeys{/tikz/number inputs/.initial=0} -\pgfkeys{/tikz/number inputs/.default=0} - -\newif\ifpgf@circuit@europeanlogicport -\ctikzset{logic ports/.is choice} -\ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue - \tikzset{and port/.style={shape=european and port}}% - \tikzset{or port/.style={shape=european or port}}% - \tikzset{xor port/.style={shape=european xor port}}% - \tikzset{buffer port/.style={shape=european buffer port}}% - \tikzset{not port/.style={shape=european not port}}% - \tikzset{nand port/.style={shape=european nand port}}% - \tikzset{nor port/.style={shape=european nor port}}% - \tikzset{xnor port/.style={shape=european xnor port}}% - % there is no Schmitt ports in european style (yet) - \tikzset{schmitt port/.style={shape=schmitt}}% - \tikzset{invschmitt port/.style={shape=invschmitt}}% -}} -\ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse - \tikzset{and port/.style={shape=american and port}}% - \tikzset{or port/.style={shape=american or port}}% - \tikzset{xor port/.style={shape=american xor port}}% - \tikzset{buffer port/.style={shape=american buffer port}}% - \tikzset{not port/.style={shape=american not port}}% - \tikzset{nand port/.style={shape=american nand port}}% - \tikzset{nor port/.style={shape=american nor port}}% - \tikzset{xnor port/.style={shape=american xnor port}}% - \tikzset{schmitt port/.style={shape=schmitt}}% - \tikzset{invschmitt port/.style={shape=invschmitt}}% -}} - -\ctikzset{logic ports origin/.is choice} -\ctikzset{logic ports origin/legacy/.code={ - \ctikzset{tripoles/american and port/origin/.initial=0.8}% - \ctikzset{tripoles/american nand port/origin/.initial=0.8}% - \ctikzset{tripoles/american nor port/origin/.initial=0.8}% - \ctikzset{tripoles/american or port/origin/.initial=0.8}% - \ctikzset{tripoles/american xor port/origin/.initial=0.8}% - \ctikzset{tripoles/american xnor port/origin/.initial=0.8}% - \ctikzset{tripoles/european and port/origin/.initial=0.8}% - \ctikzset{tripoles/european nand port/origin/.initial=0.8}% - \ctikzset{tripoles/european or port/origin/.initial=0.8}% - \ctikzset{tripoles/european nor port/origin/.initial=0.8}% - \ctikzset{tripoles/european xor port/origin/.initial=0.8}% - \ctikzset{tripoles/european xnor port/origin/.initial=0.8}% - \ctikzset{tripoles/european buffer port/origin/.initial=0.8}% - \ctikzset{tripoles/european not port/origin/.initial=0.8}% - }% -} -\ctikzset{logic ports origin/center/.code={% - \ctikzset{tripoles/american and port/origin/.initial=0}% - \ctikzset{tripoles/american nand port/origin/.initial=0}% - \ctikzset{tripoles/american nor port/origin/.initial=0}% - \ctikzset{tripoles/american or port/origin/.initial=0}% - \ctikzset{tripoles/american xor port/origin/.initial=0}% - \ctikzset{tripoles/american xnor port/origin/.initial=0}% - \ctikzset{tripoles/european and port/origin/.initial=0}% - \ctikzset{tripoles/european nand port/origin/.initial=0}% - \ctikzset{tripoles/european or port/origin/.initial=0}% - \ctikzset{tripoles/european nor port/origin/.initial=0}% - \ctikzset{tripoles/european xor port/origin/.initial=0}% - \ctikzset{tripoles/european xnor port/origin/.initial=0}% - \ctikzset{tripoles/european buffer port/origin/.initial=0}% - \ctikzset{tripoles/european not port/origin/.initial=0}% - }% -} - -\newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse -\ctikzset{american or shape/.is choice} -\ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}} -\ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}} - -\newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue -\ctikzset{logic ports draw input leads/.is choice} -\ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}} -\ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}} -\tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}} -\tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}} - -\newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue -\ctikzset{logic ports draw output leads/.is choice} -\ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}} -\ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}} -\tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}} -\tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}} - -\ctikzset{logic ports draw leads/.is choice} -\ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} -\ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} -\tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} -\tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} - -% adding a different style of xnor port -% see https://github.com/circuitikz/circuitikz/issues/467 -\ctikzset{european xnor style/.is choice} -\ctikzset{european xnor style/default/.code={% - \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}% -} -\ctikzset{european xnor style/direct/.code={% - \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}% -} - - -% old, legacy keys that should be killed over -\ctikzset{bipoles/buffer/height/.initial=1} -\ctikzset{bipoles/buffer/width/.initial=1} -\ctikzset{bipoles/not port/width/.initial=1} -\ctikzset{bipoles/not port/height/.initial=.8} -\ctikzset{bipoles/not port/circle width/.initial=.15} - -\ctikzset{tripoles/american and port/width/.initial=1.1} -\ctikzset{tripoles/american and port/height/.initial=.8} -\ctikzset{tripoles/american and port/port width/.initial=.7} -\ctikzset{tripoles/american and port/input height/.initial=.5} -\ctikzset{tripoles/american nand port/width/.initial=1.1} -\ctikzset{tripoles/american nand port/height/.initial=.8} -\ctikzset{tripoles/american nand port/port width/.initial=.7} -\ctikzset{tripoles/american nand port/circle width/.initial=.15} -\ctikzset{tripoles/american nand port/input height/.initial=.5} -\ctikzset{tripoles/american or port/width/.initial=1.1} -\ctikzset{tripoles/american or port/height/.initial=.8} -\ctikzset{tripoles/american or port/port width/.initial=.7} -\ctikzset{tripoles/american or port/input height/.initial=.5} -\ctikzset{tripoles/american or port/input skip/.initial=.25} -\ctikzset{tripoles/american or port/aaa/.initial=.6} -\ctikzset{tripoles/american or port/bbb/.initial=.4} -\ctikzset{tripoles/american or port/ccc/.initial=.5} -\ctikzset{tripoles/american or port/ddd/.initial=.0} -\ctikzset{tripoles/american nor port/width/.initial=1.1} -\ctikzset{tripoles/american nor port/height/.initial=.8} -\ctikzset{tripoles/american nor port/port width/.initial=.7} -\ctikzset{tripoles/american nor port/input height/.initial=.5} -\ctikzset{tripoles/american nor port/input skip/.initial=.25} -\ctikzset{tripoles/american nor port/circle width/.initial=.15} -\ctikzset{tripoles/american nor port/aaa/.initial=.6} -\ctikzset{tripoles/american nor port/bbb/.initial=.4} -\ctikzset{tripoles/american nor port/ccc/.initial=.5} -\ctikzset{tripoles/american nor port/ddd/.initial=.0} -\ctikzset{tripoles/american xor port/width/.initial=1.1} -\ctikzset{tripoles/american xor port/height/.initial=.8} -\ctikzset{tripoles/american xor port/port width/.initial=.7} -\ctikzset{tripoles/american xor port/input height/.initial=.5} -\ctikzset{tripoles/american xor port/input skip/.initial=.15} -\ctikzset{tripoles/american xor port/distance/.initial=.1} -\ctikzset{tripoles/american xnor port/width/.initial=1.1} -\ctikzset{tripoles/american xnor port/height/.initial=.8} -\ctikzset{tripoles/american xnor port/port width/.initial=.7} -\ctikzset{tripoles/american xnor port/input height/.initial=.5} -\ctikzset{tripoles/american xnor port/input skip/.initial=.15} -\ctikzset{tripoles/american xnor port/distance/.initial=.1} -\ctikzset{tripoles/american xnor port/circle width/.initial=.15} -\ctikzset{tripoles/american and port/origin/.initial=0.8} -\ctikzset{tripoles/american and port/inputs/.initial=2} -% variable number of inputs -\ctikzset{tripoles/american nand port/origin/.initial=0.8} -\ctikzset{tripoles/american nand port/inputs/.initial=2} -\ctikzset{tripoles/american nor port/origin/.initial=0.8} -\ctikzset{tripoles/american nor port/inputs/.initial=2} -\ctikzset{tripoles/american nor port/angle/.initial=70} -\ctikzset{tripoles/american nor port/inner/.initial=0.3} -\ctikzset{tripoles/american or port/origin/.initial=0.8} -\ctikzset{tripoles/american or port/inputs/.initial=2} -\ctikzset{tripoles/american or port/angle/.initial=70} -\ctikzset{tripoles/american or port/inner/.initial=0.3} -\ctikzset{tripoles/american xor port/origin/.initial=0.8} -\ctikzset{tripoles/american xor port/inputs/.initial=2} -\ctikzset{tripoles/american xor port/angle/.initial=70} -\ctikzset{tripoles/american xor port/inner/.initial=0.3} -\ctikzset{tripoles/american xnor port/origin/.initial=0.8} -\ctikzset{tripoles/american xnor port/inputs/.initial=2} -\ctikzset{tripoles/american xnor port/angle/.initial=70} -\ctikzset{tripoles/american xnor port/inner/.initial=0.3} - -\ctikzset{tripoles/european and port/width/.initial=1.4} -\ctikzset{tripoles/european and port/height/.initial=.65} -\ctikzset{tripoles/european and port/reserved/.initial=.6} -\ctikzset{tripoles/european and port/input height/.initial=.6} -\ctikzset{tripoles/european or port/width/.initial=1.4} -\ctikzset{tripoles/european or port/height/.initial=.65} -\ctikzset{tripoles/european or port/reserved/.initial=.6} -\ctikzset{tripoles/european or port/input height/.initial=.6} -\ctikzset{tripoles/european xor port/width/.initial=1.4} -\ctikzset{tripoles/european xor port/height/.initial=.65} -\ctikzset{tripoles/european xor port/reserved/.initial=.6} -\ctikzset{tripoles/european xor port/input height/.initial=.6} -\ctikzset{tripoles/european nand port/width/.initial=1.4} -\ctikzset{tripoles/european nand port/not height/.initial=.3} -\ctikzset{tripoles/european nand port/not width/.initial=.8} -\ctikzset{tripoles/european nand port/height/.initial=.65} -\ctikzset{tripoles/european nand port/reserved/.initial=.6} -\ctikzset{tripoles/european nand port/input height/.initial=.6} -\ctikzset{tripoles/european buffer port/width/.initial=1.4} -\ctikzset{tripoles/european buffer port/not height/.initial=.3} -\ctikzset{tripoles/european buffer port/not width/.initial=.8} -\ctikzset{tripoles/european buffer port/height/.initial=.65} -\ctikzset{tripoles/european buffer port/reserved/.initial=.6} -\ctikzset{tripoles/european buffer port/input height/.initial=0} -\ctikzset{tripoles/european not port/width/.initial=1.4} -\ctikzset{tripoles/european not port/not height/.initial=.3} -\ctikzset{tripoles/european not port/not width/.initial=.8} -\ctikzset{tripoles/european not port/height/.initial=.65} -\ctikzset{tripoles/european not port/reserved/.initial=.6} -\ctikzset{tripoles/european not port/input height/.initial=0} -\ctikzset{tripoles/european xnor port/width/.initial=1.4} -\ctikzset{tripoles/european xnor port/not height/.initial=.3} -\ctikzset{tripoles/european xnor port/not width/.initial=.8} -\ctikzset{tripoles/european xnor port/height/.initial=.65} -\ctikzset{tripoles/european xnor port/reserved/.initial=.6} -\ctikzset{tripoles/european xnor port/input height/.initial=.6} -\ctikzset{tripoles/european nor port/width/.initial=1.4} -\ctikzset{tripoles/european nor port/not height/.initial=.3} -\ctikzset{tripoles/european nor port/not width/.initial=.8} -\ctikzset{tripoles/european nor port/height/.initial=.65} -\ctikzset{tripoles/european nor port/reserved/.initial=.6} -\ctikzset{tripoles/european nor port/input height/.initial=.6} -% variable number of inputs -\ctikzset{tripoles/european and port/origin/.initial=0.8} -\ctikzset{tripoles/european and port/inputs/.initial=2} -\ctikzset{tripoles/european nand port/origin/.initial=0.8} -\ctikzset{tripoles/european nand port/inputs/.initial=2} -\ctikzset{tripoles/european or port/origin/.initial=0.8} -\ctikzset{tripoles/european or port/inputs/.initial=2} -\ctikzset{tripoles/european nor port/origin/.initial=0.8} -\ctikzset{tripoles/european nor port/inputs/.initial=2} -\ctikzset{tripoles/european xor port/origin/.initial=0.8} -\ctikzset{tripoles/european xor port/inputs/.initial=2} -\ctikzset{tripoles/european xnor port/origin/.initial=0.8} -\ctikzset{tripoles/european xnor port/inputs/.initial=2} -\ctikzset{tripoles/european buffer port/origin/.initial=0.8} -\ctikzset{tripoles/european buffer port/inputs/.initial=1}% -\ctikzset{tripoles/european not port/origin/.initial=0.8} -\ctikzset{tripoles/european not port/inputs/.initial=1}% -%%% parameters that are not used anymore after multi-input -%%% gates --- left for compatibility of source code. -\ctikzset{tripoles/american xor port/aaa/.initial=.6} -\ctikzset{tripoles/american xor port/bbb/.initial=.4} -\ctikzset{tripoles/american xor port/ccc/.initial=.5} -\ctikzset{tripoles/american xor port/ddd/.initial=.0} -\ctikzset{tripoles/american xnor port/aaa/.initial=.6} -\ctikzset{tripoles/american xnor port/bbb/.initial=.4} -\ctikzset{tripoles/american xnor port/ccc/.initial=.5} -\ctikzset{tripoles/american xnor port/ddd/.initial=.0} -%%>>> - -% flip flops and muxdemxes%<<<1 - -%% flip-flop specific keys (most others are the same as chips) - -\ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small} -\ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny} -\ctikzset{multipoles/flipflop/width/.initial=1.2} -\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6} -\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2} - -%% muxdemuxes keys - -\ctikzset{multipoles/muxdemux/base len/.initial=0.4} -\ctikzset{multipoles/muxdemux/Lh/.initial=8.0} -\ctikzset{multipoles/muxdemux/Rh/.initial=6.0} -\ctikzset{multipoles/muxdemux/w/.initial=3.0} -\ctikzset{multipoles/muxdemux/inset w/.initial=0.0} -\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0} -\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0} -\ctikzset{multipoles/muxdemux/NL/.initial=8} -\ctikzset{multipoles/muxdemux/NR/.initial=1} -\ctikzset{multipoles/muxdemux/NB/.initial=3} -\ctikzset{multipoles/muxdemux/NT/.initial=0} -\ctikzset{multipoles/muxdemux/square pins/.initial=0}% -%>>> - -% Amplifiers%<<<1 -% -% switches for op amps -% changing input polarity -% -\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse -\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} -\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} -\pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} -\ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} -% -% changing output polarity (for fully diff objects) -% -\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue -\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} -\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} -\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} -\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} - -% Operational amplifier -\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height -\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation -\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Fully differential operational amplifier -\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height -\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation -\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation -\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -\ctikzset{tripoles/en amp/width/.initial=1.7} -\ctikzset{tripoles/en amp/port width/.initial=.7} -\ctikzset{tripoles/en amp/height/.initial=1.6} -\ctikzset{tripoles/en amp/input height/.initial=.3} -\ctikzset{tripoles/en amp/up pos/.initial=.45} -\ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! -\ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed! -\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} -\tikzset{ - en amp text/.code = {% - \ctikzsetvalof{tripoles/en amp/text}{#1}% - }, - en amp text A/.code = {% - \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% - }, -} - -% Transconductance amplifier -\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid -\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid -\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation -\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Instrumentation amplifier -\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid -\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid -\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation -\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position -\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position -\ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Instrumentation amplifier with differential output -\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid -\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid -\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation -\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation -\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position -\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position -\ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Instrumentation amplifier with gain resistor terminals -\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width -\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid -\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid -\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation -\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position -\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position -\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation -\ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Plain amplifier -\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height -\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation -\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position - -% changing fonts and symbols of amplifiers -\ctikzset{amplifiers/symbol font/.code={% - \ctikzset{tripoles/inst amp ra/font=#1}% - \ctikzset{tripoles/fd inst amp/font=#1}% - \ctikzset{tripoles/inst amp/font=#1}% - \ctikzset{tripoles/gm amp/font=#1}% - \ctikzset{tripoles/en amp/font=#1}% - \ctikzset{tripoles/fd op amp/font=#1}% - \ctikzset{tripoles/op amp/font=#1}% -}} -\ctikzset{amplifiers/plus/.initial={$+$}} -\ctikzset{amplifiers/minus/.initial={$-$}} -\tikzset{amp symbol font/.code={% - \ctikzset{amplifiers/symbol font={#1}}% - } -} -\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}} -\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} -\def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} -\def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} -%%>>> - -% Transformers%<<<1 - -\ctikzset{quadpoles/transformer/inner/.initial=0.4} -\ctikzset{quadpoles/transformer/width/.initial=1.5} -\ctikzset{quadpoles/transformer/width1/.initial=.4} -\ctikzset{quadpoles/transformer/height/.initial=1.5} -\ctikzset{quadpoles/transformer/height1/.initial=.8} -\ctikzset{quadpoles/transformer core/inner/.initial=0.4} -\ctikzset{quadpoles/transformer core/width/.initial=1.5} -\ctikzset{quadpoles/transformer core/height/.initial=1.5} -\ctikzset{quadpoles/transformer core/core height/.initial=.5} -\ctikzset{quadpoles/transformer core/core width/.initial=.05} -\ctikzset{quadpoles/gyrator/inner/.initial=0.4} -\ctikzset{quadpoles/gyrator/width/.initial=1.5} -\ctikzset{quadpoles/gyrator/height/.initial=1.5} -\ctikzset{quadpoles/fourport/width/.initial=1.3} -\ctikzset{quadpoles/fourport/height/.initial=1.3} -\ctikzset{quadpoles/coupler/width/.initial=1.3} -\ctikzset{quadpoles/coupler/height/.initial=1.3} -\ctikzset{quadpoles/coupler2/width/.initial=1.3} -\ctikzset{quadpoles/coupler2/height/.initial=1.3} - -\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} - -\ctikzset{quadpoles style/.is choice} -\ctikzset{quadpoles style/inward/.code={% default value - \ctikzset{quadpoles/transformer/inner=0.4}% - \ctikzset{quadpoles/transformer/width=1.5}% - \ctikzset{quadpoles/transformer core/inner=0.4}% - \ctikzset{quadpoles/transformer core/width=1.5}% - \ctikzset{quadpoles/gyrator/inner=0.4}% - \ctikzset{quadpoles/gyrator/width=1.5}% - }% -} -\ctikzset{quadpoles style/inline/.code={% now horizontal baffle - \ctikzset{quadpoles/transformer/inner=1}% - \ctikzset{quadpoles/transformer/width=0.6}% - \ctikzset{quadpoles/transformer core/inner=1}% - \ctikzset{quadpoles/transformer core/width=0.6}% - \ctikzset{quadpoles/gyrator/inner=1} % FIXME - \ctikzset{quadpoles/gyrator/width=0.6}% - }% -} -%%>>> - -% seven segment displays by RGtti%<<<1 - -\newif\ifpgf@circ@sevenseg@dot -\newif\ifpgf@circ@sevenseg@box -\def\pgf@circ@sevenseg@dotstate{empty} -\ctikzset{seven seg/.is family} -\ctikzset{seven seg/dot/.is choice} -% none means no dot, not space for it. Empty means no dot, but space -\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}} -\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} -\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} -\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} -% -\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen -\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness -\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments -\ctikzset{seven seg/box sep/.initial=1pt}% external box gap -\ctikzset{seven seg/color on/.initial=red}% color for segment "on" -\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" -\ctikzset{seven seg/box/.is choice} -\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}} -\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}} - -\ctikzset{seven seg/bits/.initial=0000000} - -\ctikzset{seven seg/value/.code={% - \edef\@@tmp{#1}% - \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi - \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi - \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi - \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi - \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi - \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi - \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi - \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi - \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi - \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi - \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi -}} - -\tikzset{% - seven segment val/.style args={#1dot#2box#3}{% - shape=bare7seg, - /tikz/circuitikz/seven seg/value=#1, - /tikz/circuitikz/seven seg/dot=#2, - /tikz/circuitikz/seven seg/box=#3, - }, - seven segment bits/.style args={#1dot#2box#3}{% - shape=bare7seg, - /tikz/circuitikz/seven seg/bits=#1, - /tikz/circuitikz/seven seg/dot=#2, - /tikz/circuitikz/seven seg/box=#3, - }, -} -%%>>> - -% Options for twoports and blocks%<<<1 - -% Option ">" for twoports -\newif\ifpgf@circuit@inputarrow -\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} -\ctikzset{inputarrow/.is choice} -\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} -\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} - -% Option "boxed" for nodes and twoports -\newif\ifpgf@circuit@boxed -\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} -\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} -\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} -\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} - -% Option "dashed" for nodes and twoports -\newif\ifpgf@circuit@dashed -\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} -\ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}% -%>>> - -% Chips and Rotary switches (multipoles) %<<<1 -% -\ctikzset{multipoles/thickness/.initial=2} -\ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny} -% DIP (dual in line package) chips -\ctikzset{multipoles/dipchip/width/.initial=1.2} -\ctikzset{multipoles/dipchip/num pins/.initial=8} -\ctikzset{multipoles/dipchip/pin spacing/.initial=0.4} -\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}} -% QFP (quad flat package) chips -\ctikzset{multipoles/qfpchip/num pins/.initial=8} -\ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4} -\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}} -% chip numbers -\newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue -\pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} -\ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} -\pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} -\ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} -\newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue -\pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} -\ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} -\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} -\ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} -% external chip pins -\ctikzset{multipoles/external pins thickness/.initial=1} -\ctikzset{multipoles/external pins width/.initial=0.2} -\ctikzset{multipoles/external pad fraction/.initial=0} -\pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}} -\pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}} -% topmarks -\newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue -\pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} -\ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} -\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} -\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} - -% rotary switch by Romano -\ctikzset{multipoles/rotary/thickness/.initial=1} -\ctikzset{multipoles/rotary/shape/.initial=ocirc} -\ctikzset{multipoles/rotary/channels/.initial=5} -\ctikzset{multipoles/rotary/angle/.initial=60} -\ctikzset{multipoles/rotary/wiper/.initial=20} -\ctikzset{multipoles/rotary/arrow/.is choice} -\newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse -\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse -\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse -\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}} -\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}} -\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}} -\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}} - -\tikzset{% - rotary switch/.style args={#1in#2wiper#3}{% - shape=rotaryswitch, - /tikz/circuitikz/multipoles/rotary/channels=#1, - /tikz/circuitikz/multipoles/rotary/angle=#2, - /tikz/circuitikz/multipoles/rotary/wiper=#3, - }, - rotary switch -/.style args={#1in#2wiper#3}{ - rotary switch=#1 in #2 wiper #3, - /tikz/circuitikz/multipoles/rotary/arrow=none, - }, - rotary switch <-/.style args={#1in#2wiper#3}{ - rotary switch=#1 in #2 wiper #3, - /tikz/circuitikz/multipoles/rotary/arrow=ccw, - }, - rotary switch ->/.style args={#1in#2wiper#3}{ - rotary switch=#1 in #2 wiper #3, - /tikz/circuitikz/multipoles/rotary/arrow=cw, - }, - rotary switch <->/.style args={#1in#2wiper#3}{ - rotary switch=#1 in #2 wiper #3, - /tikz/circuitikz/multipoles/rotary/arrow=both, - }, - % Notice that these should be the same as the initial values of the keys - rotary switch/.default={5 in 60 wiper 20}, - rotary switch -/.default={5 in 60 wiper 20}, - rotary switch <-/.default={5 in 60 wiper 20}, - rotary switch ->/.default={5 in 60 wiper 20}, - rotary switch <->/.default={5 in 60 wiper 20}, -} -%%>>> - -% %Mechanical section%<<<1 -\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8} -\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6} -\ctikzset{bipoles/spring/height/.initial=.5} -\ctikzset{bipoles/spring/width/.initial=.5} -\ctikzset{bipoles/inerter/height/.initial=.7} -\ctikzset{bipoles/inerter/width/.initial=.175} -\ctikzset{bipoles/mass/height/.initial=.55} -\ctikzset{bipoles/mass/box height/.initial=.4} -\ctikzset{bipoles/mass/width/.initial=.5} - -\ctikzset{bipoles/damper/height/.initial=.35} -\ctikzset{bipoles/damper/length/.initial=.3} -\ctikzset{bipoles/damper/width/.initial=.4} -%%>>> - -% powerelectronic blocks%<<<1 -\ctikzset{bipoles/sacdc/width/.initial=.7} -\ctikzset{bipoles/sdcac/width/.initial=.7} -\ctikzset{bipoles/tacdc/width/.initial=.7} -\ctikzset{bipoles/tdcac/width/.initial=.7} -\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? -%>>> - % voltage and current options%<<<1 % \ctikzset{current arrow scale/.initial=16} @@ -2260,60 +824,5 @@ \tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}} %%>>> -% special cases for voltage positions%<<<1 -% the KIND is the node name without SHAPE -% See the definition above for meaning -% if bipoles/KIND/voltage/straight label distance is not defined, it uses the height -% if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance) -% -\ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4} -\ctikzset{bipoles/generic/voltage/bump b/.initial=2} -% -\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4} -\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2} -% -\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4} -\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2} -% -\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4} -\ctikzset{bipoles/memristor/voltage/bump b/.initial=2} -% -\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4} -% -\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4} -\ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8} -% -\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6} -% -\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4} -\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8} -\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6} -\ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8} -\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6} -\ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8} -% -\ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2} -% -\ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5} -\ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0} -\ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5} -\ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0} -\ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0} -\ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2} -\ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0} -\ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2} -\ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8} -\ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8} -\ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8} -\ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8} -% -\ctikzset{bipoles/short/voltage/american label distance/.initial=2.8} -\ctikzset{bipoles/open/voltage/distance from node/.initial=0.3} -% -\ctikzset{bipoles/battery/voltage/bump a/.initial=1.4} -\ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2} -\ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2} -%%>>> - \endinput % vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index 47fab3e5a52..2044c1320c5 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -9,239 +9,104 @@ % 2. under the GNU Public License. % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. - -%% Generic macro for defining a bipole shape -% #1 - additional anchors -% #2 - lower y-size of the bipole (from the center). -% #3 - #shape is the name of the shape -% #4 - upper y-size of the bipole (from the center) -% #5 - width of the bipole -% #6 - macros drawing the bipole -% -\long\def\pgfcircdeclarebipole{% - \pgfcircdeclarebipolescaled{default}} - -%% Generic macro for defining a bipole shape -% #1 - scale factor -% #2 - additional anchors -% #3 - lower y-size of the bipole (from the center). -% #4 - #shape is the name of the shape -% #5 - upper y-size of the bipole (from the center) -% #6 - width of the bipole -% #7 - macros drawing the bipole -% -\long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{ - \pgfdeclareshape{#4shape}{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedanchor{\northeast}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@y=#5\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=#6\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - } - \savedanchor{\northeastborder}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@y=#5\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y - \pgf@x=#6\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x - } - \savedanchor{\southwestborder}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@y=-#3\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y - \pgf@x=-#6\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x - } - \savedanchor{\southwest}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@y=-#3\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-#6\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - } - \savedanchor{\centerpoint}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen - \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen - \pgfpointorigin - \pgf@y=\pgf@circ@res@up - \advance\pgf@y by\pgf@circ@res@down - \pgf@y=.5\pgf@y - } - \anchor{center}{\pgfpointorigin} - \anchor{n}{ - \northeast - \pgf@x=0cm - } - \anchor{north east}{ - \northeast - } - \anchor{north west}{ - \northeast - \pgf@x=-\pgf@x - } - \anchor{ne}{ - \northeast - } - \anchor{nw}{ - \northeast - \pgf@x=-\pgf@x - } - \anchor{e}{ - \northeast - \pgf@y=0cm - } - \anchor{s}{ - \southwest - \pgf@x=0cm - } - \anchor{south east}{ - \southwest - \pgf@x=-\pgf@x - } - \anchor{south west}{ - \southwest - } - \anchor{se}{ - \southwest - \pgf@x=-\pgf@x - } - \anchor{sw}{ - \southwest - } - \anchor{w}{ - \southwest - \pgf@y=0cm - } - \anchor{north}{ - \northeast - \pgf@x=0cm - } - \anchor{east}{ - \northeast - \pgf@y=0cm - } - \anchor{south}{ - \southwest - \pgf@x=0cm - } - \anchor{west}{ - \southwest - \pgf@y=0cm - } - \anchor{right}{ - \northeast - \pgf@y=0cm - } - \anchor{above}{ - \northeast - \pgf@x=0cm - } - \anchor{left}{ - \southwest - \pgf@y=0cm - } - \anchor{below}{ - \southwest - \pgf@x=0cm - } - \anchor{a}{ - \northeast - \pgf@y=0cm - } - \anchor{b}{ - \southwest - \pgf@y=0cm - } - \savedanchor{\textanchor}{% - \pgf@y=\ht\pgfnodeparttextbox - \pgf@x=-.5\wd\pgfnodeparttextbox - } - \anchor{text}{ - \textanchor - } - \anchorborder{% - \ifpgf@circuit@bipole@inverted - \pgf@circ@res@left=-\pgf@x - \pgf@circ@res@up=-\pgf@y - \else - \pgf@circ@res@left=\pgf@x - \pgf@circ@res@up=\pgf@y - \fi - \ifdim\pgf@circ@res@up>0cm - \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder} - \else - \southwestborder - \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}} - \fi - } - - #2 - - \backgroundpath{ - \pgfsetcolor{\ctikzvalof{color}} - - \northeast - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@zero = 0cm - \pgf@circ@res@left = -\pgf@x - \pgf@circ@res@right = \pgf@x - \southwest - \pgf@circ@res@down = \pgf@y - \pgf@circ@scaled@Rlen=\scaledRlen - \pgfstartlinewidth=\pgflinewidth - \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! - #7 - - \pgfsetlinewidth{\pgfstartlinewidth} - } - } -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% anchor adjustment macros -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% Extend the border anchor position by the specified factors on the right-top (north east corner) -% and the left-down (southwest border). Argument must be number (possibly decimal) without sign - -\def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down - \anchorborder{% - \ifpgf@circuit@bipole@inverted - \pgf@circ@res@left=-\pgf@x - \pgf@circ@res@up=-\pgf@y - \else - \pgf@circ@res@left=\pgf@x - \pgf@circ@res@up=\pgf@y - \fi - \ifdim\pgf@circ@res@up>0cm - \northeastborder - \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}} - \else - \southwestborder - \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}} - \fi - } -} - -% Just up and down (very common) -\def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}} - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Standard bipole shapes declarations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%% -% Resistive components +% Resistive components: generics, resistors, wires %%%%%%%%%%%%%%%%%%%%%%%% +%% Definitions for resistive components %<<< + +% Zig Zag resistors +\ctikzset{resistors/zigs/.initial=3} +\ctikzset{resistors/width/.code={% + \ctikzset{bipoles/resistor/width=#1}% + \ctikzset{bipoles/vresistor/width=#1}% + \ctikzset{bipoles/potentiometer/width=#1}% + \ctikzset{bipoles/resistivesens/width=#1}% + \ctikzset{bipoles/photoresistor/width=#1}% + \ctikzset{bipoles/thermistor/width=#1}% + \ctikzset{bipoles/thermistorntc/width=#1}% + \ctikzset{bipoles/thermistorptc/width=#1}% + \ctikzset{bipoles/varistor/width=#1}% + \ctikzset{bipoles/generic/width=#1}% + \ctikzset{bipoles/generic potentiometer/width=#1}% + \ctikzset{bipoles/ageneric/width=#1}% + \ctikzset{bipoles/tgeneric/width=#1}% +}} +\ctikzset{wiper pos/.code={% + \ctikzset{bipoles/potentiometer/wiper pos=#1}% + \ctikzset{bipoles/generic potentiometer/wiper pos=#1}% +}} +% zigzag resistor +\ctikzset{bipoles/resistor/height/.initial=.3} +\ctikzset{bipoles/resistor/width/.initial=.8} +\ctikzset{bipoles/potentiometer/height/.initial=.8} +\ctikzset{bipoles/potentiometer/height 2/.initial=.3} +\ctikzset{bipoles/potentiometer/width/.initial=.8} +\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5} +\ctikzset{bipoles/vresistor/height/.initial=.6} +\ctikzset{bipoles/vresistor/width/.initial=.8} +\ctikzset{bipoles/resistivesens/height/.initial=.6} +\ctikzset{bipoles/resistivesens/width/.initial=.8} +% square resistors +\ctikzset{bipoles/photoresistor/height/.initial=.6} +\ctikzset{bipoles/photoresistor/height 2/.initial=.3} +\ctikzset{bipoles/photoresistor/width/.initial=.8} +\ctikzset{bipoles/thermistor/main/.initial=.7} +\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorntc/width/.initial=.8} +\ctikzset{bipoles/thermistorntc/main/.initial=.7} +\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7 +\ctikzset{bipoles/thermistorptc/width/.initial=.8} +\ctikzset{bipoles/thermistorptc/main/.initial=.7} +\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7 +\ctikzset{bipoles/thermistor/width/.initial=.8} +\ctikzset{bipoles/varistor/main/.initial=.7} +\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/varistor/width/.initial=.8} +\ctikzset{bipoles/generic/height/.initial=.30} +\ctikzset{bipoles/generic/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} +\ctikzset{bipoles/generic potentiometer/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5} +\ctikzset{bipoles/ageneric/height/.initial=.30} +\ctikzset{bipoles/tgeneric/height/.initial=.70} +\ctikzset{bipoles/tgeneric/width/.initial=.80} +\ctikzset{bipoles/ageneric/width/.initial=.80} +\ctikzset{bipoles/memristor/height/.initial=.30} +\ctikzset{bipoles/memristor/wave height/.initial=.5} +\ctikzset{bipoles/memristor/width/.initial=.80} + +\newif\ifpgf@circuit@europeanresistor +\ctikzset{resistor/.is choice} +\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } +\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue } +\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} +\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}% + +% wires (open, shorts, ...) + +\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/voltage/straight label distance/.initial=0} +\ctikzset{bipoles/open/voltage/distance from node/.initial=.2} +\ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning +\ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning +% multiwire +\ctikzset{bipoles/multiwire/height/.initial=0.4} +\ctikzset{bipoles/multiwire/width/.initial=0.2} +\ctikzset{bipoles/multiwire/spacing/.initial=0.05} +% crossing wires +\ctikzset{bipoles/crossing/size/.initial=.2} +%%>>> + +%% Shapes for generic, resistives and wires components %<<< %% Short circuit %%% NOTICE that the short is really NOT drawn; we trust the fact that its @@ -336,9 +201,29 @@ \pgfusepath{draw} } +%%%%%%%%%%%%%%%% +%% Crossing +%%%%%%%%%%%%%%%% + +%% crossing bipole (but see also nodes) +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/crossing/size}} +{crossing} +{\ctikzvalof{bipoles/crossing/size}} +{\ctikzvalof{bipoles/crossing/size}}{ + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope +} % % -%% Generic bipole - used as resistor by some (bleah) +%% Generic bipole - used as resistor by some \pgfcircdeclarebipolescaled{resistors} {} {\ctikzvalof{bipoles/generic/height}} @@ -555,6 +440,30 @@ \pgfusepath{draw} } +%% Varistor +\pgfcircdeclarebipolescaled{resistors} +{ + \pgfcirc@border@extend@updown{1}{1.4} +} +{\ctikzvalof{bipoles/varistor/height}} +{varistor} +{\ctikzvalof{bipoles/varistor/height}} +{\ctikzvalof{bipoles/varistor/width}} +{ + \pgfscope + \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}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}} +} + %% Generic tunable \pgfcircdeclarebipolescaled{resistors} { @@ -715,12 +624,92 @@ \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} \pgfusepath{draw} \endpgfscope -} +}% %>>> + +%% Paths for resistive components: generic, resistors and wires% %<<< + +%% GENERICS +\def\pgf@circ@empty@path#1{} +\pgfcirc@activate@bipole@simple{l}{generic} +\pgfcirc@activate@bipole@simple{l}{ageneric} +\pgfcirc@activate@bipole@simple{l}{tgeneric} +\pgfcirc@activate@bipole@simple{l}{xgeneric} +\pgfcirc@activate@bipole@simple{l}{fullgeneric} +\pgfcirc@activate@bipole@simple{l}{tfullgeneric} +\pgfcirc@activate@bipole@simple{l}{short} +\pgfcirc@activate@bipole@simple{l}{open} + +%% wires and crossings + +\pgfcirc@activate@bipole@simple{l}{crossing} +\pgfcirc@style@to@style{crossing}{xing} +\pgfcirc@activate@bipole@simple{l}{multiwire} +\pgfcirc@activate@bipole@simple{l}{bmultiwire} +\pgfcirc@activate@bipole@simple{l}{tmultiwire} + +% automatically switching path --- to be defined manually +\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi} +\pgfcirc@path@to@style{l}{resistor}{resistor}{} +\pgfcirc@node@to@style{l}{resistor}{american resistor}{} +\pgfcirc@node@to@style{l}{generic}{european resistor}{} +\pgfcirc@style@to@style{resistor}{R} + +\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi} +\pgfcirc@path@to@style{l}{vresistor}{variable resistor}{} +\pgfcirc@node@to@style{l}{vresistor}{variable american resistor}{} +\pgfcirc@node@to@style{l}{tgeneric}{variable european resistor}{} +\pgfcirc@style@to@style{variable resistor}{vR} + +\def\pgf@circ@resistivesens@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi} +\pgfcirc@path@to@style{l}{resistivesens}{resistive sensor}{} +\pgfcirc@node@to@style{l}{resistivesens}{american resistive sensor}{} +\pgfcirc@node@to@style{l}{thermistor}{european resistive sensor}{} +\pgfcirc@style@to@style{resistive sensor}{sR} + +\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi} +\pgfcirc@path@to@style{l}{potentiometer}{potentiometer}{} +\pgfcirc@node@to@style{l}{potentiometer}{american potentiometer}{} +\pgfcirc@node@to@style{l}{genericpotentiometer}{european potentiometer}{} +\pgfcirc@style@to@style{potentiometer}{pR} + +\pgfcirc@activate@bipole@simple{l}{thermistor} +\pgfcirc@style@to@style{thermistor}{thR} +\pgfcirc@activate@bipole{l}{thermistorptc}{thermistorptc}{thermistor ptc} +\pgfcirc@style@to@style{thermistor ptc}{thRp} +\pgfcirc@activate@bipole{l}{thermistorntc}{thermistorntc}{thermistor ntc} +\pgfcirc@style@to@style{thermistor ntc}{thRn} +\pgfcirc@activate@bipole@simple{l}{photoresistor} +\pgfcirc@style@to@style{photoresistor}{phR} +\pgfcirc@activate@bipole@simple{l}{varistor} +\pgfcirc@activate@bipole@simple{l}{memristor} +\pgfcirc@style@to@style{memristor}{Mr}% +% %>>> %%%%%%%%%%%%%% %% Capacitors %%%%%%%%%%%%% +%% Definitions for Capacitors%<<<1 +\ctikzset{bipoles/capacitor/height/.initial=.6} +\ctikzset{bipoles/capacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/height/.initial=.5} +\ctikzset{bipoles/ecapacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm} +%%% pcapacitor is deprecated +\ctikzset{bipoles/pcapacitor/height/.initial=.6} +\ctikzset{bipoles/pcapacitor/width/.initial=.2} +\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/ccapacitor/height/.initial=.6} +\ctikzset{bipoles/ccapacitor/width/.initial=.12} +\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/vcapacitor/height/.initial=.6} +\ctikzset{bipoles/vcapacitor/width/.initial=.5} +\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} +\ctikzset{bipoles/piezoelectric/height/.initial=.7} +\ctikzset{bipoles/piezoelectric/width/.initial=.5}% +%>>> + +%% Shapes for capacitors%<<< %% Plain Capacitor \pgfcircdeclarebipolescaled{capacitors} {} @@ -914,11 +903,103 @@ \pgf@circ@draworfill \endpgfscope } +% %>>> + +%% Paths for capacitors%<<< +\pgfcirc@activate@bipole@simple{l}{capacitor} +\pgfcirc@style@to@style{capacitor}{C} +\pgfcirc@activate@bipole@simple{l}{ecapacitor} +\pgfcirc@style@to@style{ecapacitor}{eC} +\pgfcirc@style@to@style{ecapacitor}{elko} +\pgfcirc@activate@bipole{l}{polarcapacitor}{polarcapacitor}{polar capacitor} +%% polar capacitor is deprecated, use curved capacitor instead +\pgfcirc@style@to@style{polar capacitor}{pC} +\pgfcirc@activate@bipole{l}{ccapacitor}{ccapacitor}{curved capacitor} +\pgfcirc@style@to@style{curved capacitor}{cC} +\pgfcirc@activate@bipole{l}{vcapacitor}{vcapacitor}{variable capacitor} +\pgfcirc@style@to@style{variable capacitor}{vC} +\pgfcirc@activate@bipole@simple{l}{piezoelectric} +\pgfcirc@style@to@style{piezoelectric}{PZ} +\pgfcirc@activate@bipole{l}{capacitivesens}{capacitivesens}{capacitive sensor} +\pgfcirc@style@to@style{capacitive sensor}{sC} +% %>>> %%%%%%%%%%%%%%% %% Inductors %%%%%%%%%%%%%%% +% Definitions of Inductors%<<<1 + +\ctikzset{inductors/coils/.code={% + \ctikzset{bipoles/cuteinductor/coils=#1}% + \ctikzset{bipoles/cutechoke/coils=#1}% + \ctikzset{bipoles/americaninductor/coils=#1}% + \ctikzset{bipoles/vcuteinductor/coils=#1}% + \ctikzset{bipoles/vamericaninductor/coils=#1}% +}} +\ctikzset{inductors/width/.code={% + \ctikzset{bipoles/cuteinductor/width=#1}% + \ctikzset{bipoles/cutechoke/width=#1}% + \ctikzset{bipoles/americaninductor/width=#1}% + \ctikzset{bipoles/vcuteinductor/width=#1}% + \ctikzset{bipoles/vamericaninductor/width=#1}% + \ctikzset{bipoles/fullgeneric/width=#1}% + \ctikzset{bipoles/tfullgeneric/width=#1}% +}} +\ctikzset{bipoles/cuteinductor/height/.initial=.3} +\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15} +\ctikzset{bipoles/cuteinductor/width/.initial=.6} +\ctikzset{bipoles/cuteinductor/coils/.initial=5} +\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil +%% Cute choke settings +\ctikzset{bipoles/cutechoke/height/.initial=.3} +\ctikzset{bipoles/cutechoke/lower coil height/.initial=.15} +\ctikzset{bipoles/cutechoke/width/.initial=.6} +\ctikzset{bipoles/cutechoke/coils/.initial=5} +\ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil +\ctikzset{bipoles/cutechoke/cstep/.initial=.3} +\ctikzset{bipoles/cutechoke/cdist/.initial=1.3} +\ctikzset{bipoles/cutechoke/cthick/.initial=1} +\newif\ifpgf@circuit@bipole@twolineschoke +\pgf@circuit@bipole@twolineschokefalse +\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +\ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +% +\ctikzset{bipoles/americaninductor/height/.initial=.3} +\ctikzset{bipoles/americaninductor/height 2/.initial=.1} +\ctikzset{bipoles/americaninductor/width/.initial=.8} +\ctikzset{bipoles/americaninductor/coils/.initial=4} +\ctikzset{bipoles/americaninductor/coil height/.initial=.15} +\ctikzset{bipoles/vcuteinductor/height/.initial=.6} +\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3} +\ctikzset{bipoles/vcuteinductor/width/.initial=.6} +\ctikzset{bipoles/vcuteinductor/coils/.initial=5} +\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil +\ctikzset{bipoles/vamericaninductor/height/.initial=.6} +\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2} +\ctikzset{bipoles/vamericaninductor/width/.initial=.8} +\ctikzset{bipoles/vamericaninductor/coils/.initial=4} +\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15} +\ctikzset{bipoles/tfullgeneric/height/.initial=.70} +\ctikzset{bipoles/tfullgeneric/width/.initial=.80} +\ctikzset{bipoles/fullgeneric/height/.initial=.30} +\ctikzset{bipoles/fullgeneric/width/.initial=.80} +\ctikzset{inductor/.is choice} +\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}} +\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}} +\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}} + +\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}} +\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}} +\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}} +\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}} +\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}} + +%%>>> + +%% Shapes for inductors%<<< %% cute inductor \pgfcircdeclarebipolescaled{inductors} { @@ -1303,11 +1384,183 @@ \pgfusepath{draw} \endpgfscope } +% %>>> + +%% Paths for Inductors%<<< +%% these are complex because of the three-way set +%% should be simplified +\def\pgf@circ@inductor@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductor@path{#1}% + \else% + \pgf@circ@americaninductor@path{#1}% + \fi% + \fi% +} +\pgfcirc@path@to@style{l}{inductor}{inductor}{} +\pgfcirc@style@to@style{inductor}{L} +\pgfcirc@activate@bipole{l}{europeaninductor}{fullgeneric}{european inductor} +\pgfcirc@activate@bipole{l}{americaninductor}{americaninductor}{american inductor} +\pgfcirc@activate@bipole{l}{cuteinductor}{cuteinductor}{cute inductor} + +\def\pgf@circ@vinductor@path#1{ + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@veuropeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@vcuteinductor@path{#1}% + \else% + \pgf@circ@vamericaninductor@path{#1}% + \fi% + \fi% +} +\pgfcirc@path@to@style{l}{vinductor}{variable inductor}{} +\pgfcirc@style@to@style{variable inductor}{vL} +\pgfcirc@activate@bipole{l}{veuropeaninductor}{tfullgeneric}{variable european inductor} +\pgfcirc@activate@bipole{l}{vamericaninductor}{vamericaninductor}{variable american inductor} +\pgfcirc@activate@bipole{l}{vcuteinductor}{vcuteinductor}{variable cute inductor} + +\def\pgf@circ@inductivesens@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductivesens@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductivesens@path{#1}% + \else% + \pgf@circ@americaninductivesens@path{#1}% + \fi% + \fi% +} +\pgfcirc@path@to@style{l}{inductivesens}{inductive sensor}{} +\pgfcirc@style@to@style{inductive sensor}{sL} +\pgfcirc@activate@bipole{l}{europeaninductivesens}{sfullgeneric}{european inductive sensor} +\pgfcirc@activate@bipole{l}{americaninductivesens}{samericaninductor}{american inductive sensor} +\pgfcirc@activate@bipole{l}{cuteinductivesens}{scuteinductor}{cute inductive sensor} + +\pgfcirc@activate@bipole{l}{cutechoke}{cutechoke}{cute choke} +% %>>> %%%%%%%%%%% -%% Battery +%% Sources (batteries, independent, dependents and so on %%%%%%%%%%% +% Definitions for Sources%<<<1 + +\ctikzset{bipoles/esource/height/.initial=.60} +\ctikzset{bipoles/esource/width/.initial=.60} +\ctikzset{bipoles/pvsource/height/.initial=.60} +\ctikzset{bipoles/pvsource/width/.initial=.60} +\ctikzset{bipoles/isource/height/.initial=.60} +\ctikzset{bipoles/isource/width/.initial=.60} +\ctikzset{bipoles/oosource/height/.initial=.60} +\ctikzset{bipoles/oosource/width/.initial=.60} +\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/dcisource/angle/.initial=80} +\ctikzset{bipoles/dcisource/height/.initial=.60} +\ctikzset{bipoles/dcisource/width/.initial=.60} +\ctikzset{bipoles/dcvsource/height/.initial=.60} +\ctikzset{bipoles/dcvsource/width/.initial=.60} +\ctikzset{bipoles/vsourcetri/height/.initial=.60} +\ctikzset{bipoles/vsourcetri/width/.initial=.60} +\ctikzset{bipoles/isourceam/height/.initial=.60} +\ctikzset{bipoles/isourceam/width/.initial=.60} +\ctikzset{bipoles/vsource/height/.initial=.60} +\ctikzset{bipoles/vsource/width/.initial=.60} +\ctikzset{bipoles/vsourceam/height/.initial=.60} +\ctikzset{bipoles/vsourceam/width/.initial=.60} +\ctikzset{bipoles/vsourceam/margin/.initial=.7} +\ctikzset{bipoles/isourcesin/height/.initial=.60} +\ctikzset{bipoles/isourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesin/height/.initial=.60} +\ctikzset{bipoles/vsourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesquare/height/.initial=.60} +\ctikzset{bipoles/vsourcesquare/width/.initial=.60} +\ctikzset{bipoles/cisource/height/.initial=.7} +\ctikzset{bipoles/cisource/width/.initial=.7} +\ctikzset{bipoles/cisourceam/height/.initial=.7} +\ctikzset{bipoles/cisourceam/width/.initial=.7} +\ctikzset{bipoles/ecsource/height/.initial=.7} +\ctikzset{bipoles/ecsource/width/.initial=.7} +\ctikzset{bipoles/cvsource/height/.initial=.7} +\ctikzset{bipoles/cvsource/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/height/.initial=.7} +\ctikzset{bipoles/cvsourceam/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/margin/.initial=.7} +\ctikzset{bipoles/cvsourceam/text scale/.initial=1} +\ctikzset{bipoles/cisourcesin/width/.initial=.7} +\ctikzset{bipoles/cvsourcesin/height/.initial=.7} +\ctikzset{bipoles/cvsourcesin/width/.initial=.7} +\ctikzset{bipoles/battery/height/.initial=.6} +\ctikzset{bipoles/battery/width/.initial=.3} +\ctikzset{bipoles/battery1/height/.initial=.6} +\ctikzset{bipoles/battery1/width/.initial=.3} +\ctikzset{bipoles/battery2/height/.initial=.6} +\ctikzset{bipoles/battery2/width/.initial=.3} +% noise sources +\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} + +% % % ootransformer +\ctikzset{bipoles/oosourcetrans/height/.initial=.6} +\ctikzset{bipoles/oosourcetrans/width/.initial=.6} +\ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1} + +% % % oootransformer +\ctikzset{bipoles/ooosource/height/.initial=.6} +\ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1} + +% % % primary windings +\newif\ifpgf@circ@prim@delta +\newif\ifpgf@circ@prim@wye +\newif\ifpgf@circ@prim@zig +\pgfkeys{tikz/prim/.is choice} +\pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}} +\pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}} +\pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}} + +% % % secondary windings +\newif\ifpgf@circ@sec@delta +\newif\ifpgf@circ@sec@wye +\newif\ifpgf@circ@sec@zig +\pgfkeys{tikz/sec/.is choice} +\pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}} +\pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}} +\pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}} + +% % % tertiary windings (ooosource) +\newif\ifpgf@circ@tert@delta +\newif\ifpgf@circ@tert@wye +\newif\ifpgf@circ@tert@zig +\pgfkeys{tikz/tert/.is choice} +\pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}} +\pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}} +\pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}% +%%>>> + +%% Nodes definitions for sources%<<< + %% Battery \pgfcircdeclarebipolescaled{batteries} {} @@ -2414,11 +2667,246 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} \pgfsetroundcap\pgfusepath{draw} } +% %>>> + +%% Paths definitions for Sources%<<< + +%% Batteries + +\pgfcirc@activate@bipole@simple@opt{v}{battery}{\circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@opt{v}{batteryone}{battery1}{battery1}{\circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@opt{v}{batterytwo}{battery2}{battery2}{\circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +%% Sources: voltage + +\pgfcirc@activate@bipole@opt{v}{vsource}{vsource}{european voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@opt{v}{vsourceam}{vsourceAM}{american voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false} +\pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi voltage source}{voltage source} +\pgfcirc@style@to@style{voltage source}{vsource} +\pgfcirc@style@to@style{voltage source}{V} + +\pgfcirc@activate@bipole@opt{v}{cvsource}{cvsource}{european controlled voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@opt{v}{cvsourceam}{cvsourceAM}{american controlled voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false} +\pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source}{controlled voltage source} +\pgfcirc@style@to@style{controlled voltage source}{cvsource} +\pgfcirc@style@to@style{controlled voltage source}{controlled vsource} +\pgfcirc@style@to@style{controlled voltage source}{cV} + +\pgfcirc@activate@bipole@simple@opt{v}{esource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@opt{v}{ecsource}{ecsource}{empty controlled source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{empty controlled source}{ecsource} + +\pgfcirc@activate@bipole@opt{v}{vsourcesin}{vsourcesin}{sinusoidal voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{sinusoidal voltage source}{vsourcesin} +\pgfcirc@style@to@style{sinusoidal voltage source}{sV} + +\pgfcirc@activate@bipole@opt{v}{cvsourcesin}{cvsourcesin}{controlled sinusoidal voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{controlled sinusoidal voltage source}{cvsourcesin} +\pgfcirc@style@to@style{controlled sinusoidal voltage source}{controlled vsourcesin} +\pgfcirc@style@to@style{controlled sinusoidal voltage source}{csV} + +\pgfcirc@activate@bipole@opt{v}{vsourcesquare}{vsourcesquare}{square voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{square voltage source}{vsourcesquare} +\pgfcirc@style@to@style{square voltage source}{sqV} + +\pgfcirc@activate@bipole@opt{v}{vsourcetri}{vsourcetri}{triangle voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{triangle voltage source}{vsourcetri} +\pgfcirc@style@to@style{triangle voltage source}{tV} + +\pgfcirc@activate@bipole@simple@opt{v}{pvsource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@simple@opt{v}{dcvsource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@opt{v}{oosource}{oosource}{voosource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@simple@opt{v}{ooosource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@simple@opt{v}{oosourcetrans}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@opt{v}{vsourceC}{vsourceC}{cute european voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{cute european voltage source}{vsourceC} +\pgfcirc@style@to@style{cute european voltage source}{ceV} + +\pgfcirc@activate@bipole@opt{v}{cvsourceC}{cvsourceC}{cute european controlled voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{cute european controlled voltage source}{cvsourceC} +\pgfcirc@style@to@style{cute european controlled voltage source}{cceV} + +\pgfcirc@activate@bipole@opt{v}{vsourceN}{vsourceN}{noise voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{noise voltage source}{vsourceN} +\pgfcirc@style@to@style{noise voltage source}{nV} + +%% Sources: current + +\pgfcirc@activate@bipole@opt{i}{isource}{isource}{european current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@activate@bipole@opt{i}{isourceam}{isourceAM}{american current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{\ifpgf@circuit@europeancurrent european \else american \fi current source}{current source} +\pgfcirc@style@to@style{current source}{isource} +\pgfcirc@style@to@style{current source}{I} + +\pgfcirc@activate@bipole@opt{i}{cisource}{cisource}{european controlled current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@activate@bipole@opt{i}{cisourceam}{cisourceAM}{american controlled current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled current source}{controlled current source} +\pgfcirc@style@to@style{controlled current source}{cisource} +\pgfcirc@style@to@style{controlled current source}{controlled isource} +\pgfcirc@style@to@style{controlled current source}{cI} + +\pgfcirc@activate@bipole@opt{i}{isourcesin}{isourcesin}{sinusoidal current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{sinusoidal current source}{isourcesin} +\pgfcirc@style@to@style{sinusoidal current source}{sI} + +\pgfcirc@activate@bipole@opt{i}{cisourcesin}{cisourcesin}{controlled sinusoidal current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{controlled sinusoidal current source}{cisourcesin} +\pgfcirc@style@to@style{controlled sinusoidal current source}{controlled isourcesin} +\pgfcirc@style@to@style{controlled sinusoidal current source}{csI} + +\pgfcirc@activate@bipole@simple@opt{i}{dcisource}{% + \circuitikzbasekey/bipole/is current=true} + +\pgfcirc@activate@bipole@opt{i}{oosource}{oosource}{ioosource}{% + \circuitikzbasekey/bipole/is current=true} + +\pgfcirc@activate@bipole@opt{i}{isourceC}{isourceC}{cute european current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{cute european current source}{isourceC} +\pgfcirc@style@to@style{cute european current source}{ceI} + +\pgfcirc@activate@bipole@opt{i}{cisourceC}{cisourceC}{cute european controlled current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{cute european controlled current source}{cisourceC} +\pgfcirc@style@to@style{cute european controlled current source}{cceI} + +\pgfcirc@activate@bipole@opt{i}{isourceN}{isourceN}{noise current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{noise current source}{isourceN} +\pgfcirc@style@to@style{noise current source}{nI} + +% build alias with voltage and current directions (legacy) + +\def\pgf@temp#1{ + \pgfcirc@style@to@style@label{voltage source}{V#1}{v#1} + \pgfcirc@style@to@style@label{controlled voltage source}{cV#1}{v#1} + \pgfcirc@style@to@style@label{sinusoidal voltage source}{sV#1}{v#1} + \pgfcirc@style@to@style@label{controlled sinusoidal voltage source}{csV#1}{v#1} +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} +\def\pgf@temp#1{ + \pgfcirc@style@to@style@label{current source}{I#1}{i#1} + \pgfcirc@style@to@style@label{controlled current source}{cI#1}{i#1} + \pgfcirc@style@to@style@label{sinusoidal current source}{sI#1}{i#1} + \pgfcirc@style@to@style@label{controlled sinusoidal current source}{csI#1}{i#1} +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} +% %>>> %%%%%%%%%%%%%% %% Diodes %%%%%%%%%%%%%% +% Definitions for diodes%<<<1 + +\ctikzset{bipoles/diode/height/.initial=.50} +\ctikzset{bipoles/diode/width/.initial=.40} +\ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} +\ctikzset{bipoles/bidirectionaldiode/width/.initial=1} +\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3} +\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} +\ctikzset{bipoles/varcap/height/.initial=.50} +\ctikzset{bipoles/varcap/width/.initial=.45} +\ctikzset{tripoles/thyristor/height/.initial=1.10} +\ctikzset{tripoles/thyristor/height 2/.initial=.5} +\ctikzset{tripoles/thyristor/width/.initial=1.0} +\ctikzset{tripoles/thyristor/diode height/.initial=.5} +\ctikzset{tripoles/thyristor/diode width left/.initial=.4} +\ctikzset{tripoles/thyristor/diode width right/.initial=.3} + +\ctikzset{tripoles/triac/height/.initial=1.1} +\ctikzset{tripoles/triac/width/.initial=1} +\ctikzset{tripoles/triac/diode width left/.initial=.3} +\ctikzset{tripoles/triac/diode width right/.initial=.3} +% +% Flipping arrows in LED and photodiodes +% +\newif\ifpgf@led@fliparrows +\newif\ifpgf@pd@fliparrows +\pgf@led@fliparrowsfalse +\pgf@pd@fliparrowsfalse +% +% by default the arrows start (LED) and go (PD) to the anode. +% +\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} +\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} +% +% but they can start form the cathode (LED) or go to it (PD) +% +\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} +\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} + +\newif\ifpgf@circuit@strokediode +\newif\ifpgf@circuit@fulldiode +\pgf@circuit@strokediodefalse +\pgf@circuit@fulldiodefalse + +\ctikzset{diode/.is choice} +\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default +\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } +\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} + +\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}} +\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}} +\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}} + +%%>>> + +%% Node components for diodes %<<<1 + %% Black generic diode \pgfcircdeclarebipolescaled{diodes} {} @@ -3152,12 +3640,126 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfusepath{draw} -} +}% %>>> + +%% Paths definitions for Diodes%<<< + +\def\pgfcirc@tmp@generatediodes#1#2{ + \pgfcirc@activate@bipole{l}{#1diode}{#1diode}{#1 diode} + \pgfcirc@style@to@style{#1 diode}{D#2} + \pgfcirc@activate@bipole{l}{#1zdiode}{#1zdiode}{#1 Zener diode} + \pgfcirc@style@to@style{#1 Zener diode}{zD#2} + \pgfcirc@activate@bipole{l}{#1zzdiode}{#1zzdiode}{#1 ZZener diode} + \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2} + \pgfcirc@activate@bipole{l}{#1sdiode}{#1sdiode}{#1 Schottky diode} + \pgfcirc@style@to@style{#1 Schottky diode}{sD#2} + \pgfcirc@activate@bipole{l}{#1tdiode}{#1tdiode}{#1 tunnel diode} + \pgfcirc@style@to@style{#1 tunnel diode}{tD#2} + \pgfcirc@activate@bipole{l}{#1lediode}{#1lediode}{#1 led} + \pgfcirc@style@to@style{#1 led}{leD#2} + \pgfcirc@activate@bipole{l}{#1pdiode}{#1pdiode}{#1 photodiode} + \pgfcirc@style@to@style{#1 photodiode}{pD#2} + \pgfcirc@activate@bipole{l}{#1varcap}{#1varcap}{#1 varcap} + \pgfcirc@style@to@style{#1 varcap}{VC#2} + \pgfcirc@activate@bipole{l}{#1bidirectionaldiode}{#1bidirectionaldiode}{#1 bidirectionaldiode} + \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2} + \pgfcirc@activate@bipole{l}{#1thyristor}{#1thyristor}{#1 thyristor} + \pgfcirc@style@to@style{#1 thyristor}{Ty#2} + \pgfcirc@activate@bipole{l}{#1triac}{#1triac}{#1 triac} + \pgfcirc@style@to@style{#1 triac}{Tr#2} +} +\pgfcirc@tmp@generatediodes{full}{*} +\pgfcirc@tmp@generatediodes{empty}{o} +\def\pgfcirc@tmp@generatestrokeddiodes#1#2{ + \pgfcirc@node@to@style{l}{emptydiode}{#1 diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 diode}{D#2} + \pgfcirc@node@to@style{l}{emptyzdiode}{#1 Zener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 Zener diode}{zD#2} + \pgfcirc@node@to@style{l}{emptyzzdiode}{#1 ZZener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2} + \pgfcirc@node@to@style{l}{emptysdiode}{#1 Schottky diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 Schottky diode}{sD#2} + \pgfcirc@node@to@style{l}{emptytdiode}{#1 tunnel diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 tunnel diode}{tD#2} + \pgfcirc@node@to@style{l}{emptylediode}{#1 led}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 led}{leD#2} + \pgfcirc@node@to@style{l}{emptypdiode}{#1 photodiode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 photodiode}{pD#2} + \pgfcirc@node@to@style{l}{emptyvarcap}{#1 varcap}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 varcap}{VC#2} + \pgfcirc@node@to@style{l}{emptybidirectionaldiode}{#1 bidirectionaldiode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2} + \pgfcirc@node@to@style{l}{emptythyristor}{#1 thyristor}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 thyristor}{Ty#2} + \pgfcirc@node@to@style{l}{emptytriac}{#1 triac}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 triac}{Tr#2} +} +\pgfcirc@tmp@generatestrokeddiodes{stroke}{-} +\def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi} +% these are auto-switching styles +\pgfcirc@style@to@style{\pgfcircdiodestylemacro diode}{diode} +\pgfcirc@style@to@style{diode}{D} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro Zener diode}{Zener diode} +\pgfcirc@style@to@style{Zener diode}{zD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro ZZener diode}{ZZener diode} +\pgfcirc@style@to@style{ZZener diode}{zzD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro Schottky diode}{Schottky diode} +\pgfcirc@style@to@style{Schottky diode}{sD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro tunnel diode}{tunnel diode} +\pgfcirc@style@to@style{tunnel diode}{tD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro led}{led} +\pgfcirc@style@to@style{led}{leD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro photodiode}{photodiode} +\pgfcirc@style@to@style{photodiode}{pD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro varcap}{varcap} +\pgfcirc@style@to@style{varcap}{VC} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro bidirectionaldiode}{bidirectionaldiode} +\pgfcirc@style@to@style{bidirectionaldiode}{biD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor} +\pgfcirc@style@to@style{thyristor}{Ty} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro triac}{triac} +\pgfcirc@style@to@style{triac}{Tr} +% %>>> %%%%%%%%%%%%% -%% switches +%% switches and buttons %%%%%%%%%%%%% +%% Definitions for switches%<<<1 + +\ctikzset{bipoles/spst/height/.initial=.35} +\ctikzset{bipoles/spst/width/.initial=.35} +\ctikzset{bipoles/spst/depth/.initial=.2} +\ctikzset{bipoles/nos/height/.initial=.3} +\ctikzset{bipoles/nos/width/.initial=.35} +\ctikzset{bipoles/nos/depth/.initial=.2} +\ctikzset{bipoles/ncs/height/.initial=.35} +\ctikzset{bipoles/ncs/width/.initial=.35} +\ctikzset{bipoles/ncs/depth/.initial=.2} +\ctikzset{bipoles/pushbutton/height/.initial=.5} +\ctikzset{bipoles/pushbutton/height 2/.initial=.2} +\ctikzset{bipoles/pushbutton/width/.initial=.50} +%%% reed switch +\ctikzset{bipoles/reed/height/.initial=.4} +\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos +\ctikzset{bipoles/reed/depth/.initial=.4} +%% Cute switches +\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}} +\ctikzset{bipoles/cuteswitch/height/.initial=.6} +\ctikzset{bipoles/cuteswitch/height 2/.initial=.2} +\ctikzset{bipoles/cuteswitch/width/.initial=.50} +\ctikzset{bipoles/cuteswitch/thickness/.initial=1} + +\ctikzset{tripoles/spdt/width/.initial=.85} +\ctikzset{tripoles/spdt/height/.initial=.45} +\ctikzset{tripoles/spdt/margin/.initial=.45} + +\ctikzset{tripoles/toggleswitch/height/.initial=.8} +\ctikzset{tripoles/toggleswitch/height 2/.initial=.0} +\ctikzset{tripoles/toggleswitch/width/.initial=.80} +%%>>> + +%% Shapes Node for bipoles switches and similar things%<<< %% (Closing) SPST \pgfcircdeclarebipolescaled{switches} {} @@ -3473,10 +4075,392 @@ \pgfusepath{draw} } +\pgfcircdeclarebipole{ + \anchor{out 1}{ + \northeast + \pgf@y=0cm + } + \anchor{out 2}{ + \northeast + \pgf@y=.8\pgf@y + } +} +{\ctikzvalof{tripoles/toggleswitch/height 2}} +{toggleswitch} +{\ctikzvalof{tripoles/toggleswitch/height}} +{\ctikzvalof{tripoles/toggleswitch/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} + \pgfusepath{draw} + + + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \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} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetdash{}{0cm} +} + +% %>>> + +%% Shape nodes for switches (non-bipoles)%<<< + +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + +% Legacy spdt +\pgfdeclareshape{spdt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out 1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{out 2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left + + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} + \endpgfscope + + \pgfscope + \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} + {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} + } + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + } +} + + +% cute switch "node" shapes, matching with cute "to" shapes +% #1 -> name +% #2 -> barposition +% #3 -> arrowcode +\long\def\pgfcircdeclarecutespdt#1#2#3{ + \pgfdeclareshape{#1} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@x=.25\pgf@x + } + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % shape type + \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}} + % mid of the lever, to stack switches + \anchor{mid}{\midlever} + % center anchors + \anchor{cin}{ \northwest \pgf@y=0pt} + \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x } + \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius} + \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius} + \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y } + + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + % terminals + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + + } + } +} + +\pgfcircdeclarecutespdt{cute spdt up} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt mid} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{} + +\pgfcircdeclarecutespdt{cute spdt down} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt up arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} + \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt mid arrow} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} + \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt down arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} + \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} +% %>>> + +%% Paths Switches and buttons%<<< + +\pgfcirc@activate@bipole{l}{cspst}{cspst}{closing switch} +\pgfcirc@style@to@style{closing switch}{switch} +\pgfcirc@style@to@style{closing switch}{cspst} +\pgfcirc@style@to@style{switch}{spst} +\pgfcirc@activate@bipole{l}{ospst}{ospst}{opening switch} +\pgfcirc@style@to@style{opening switch}{ospst} + +\pgfcirc@activate@bipole@simple{l}{nos} +\pgfcirc@style@to@style{nos}{normal open switch} +\pgfcirc@activate@bipole@simple{l}{ncs} +\pgfcirc@style@to@style{ncs}{normal closed switch} + +\pgfcirc@activate@bipole{l}{pushbutton}{pushbutton}{push button} +\pgfcirc@style@to@style{push button}{nopb} +\pgfcirc@style@to@style{push button}{normally open push button} +\pgfcirc@activate@bipole{l}{ncpushbutton}{ncpushbutton}{ncpb} +\pgfcirc@style@to@style{ncpb}{normally closed push button} +\pgfcirc@activate@bipole{l}{pushbuttonc}{pushbuttonc}{nopbc} +\pgfcirc@style@to@style{nopbc}{normally open push button closed} +\pgfcirc@activate@bipole{l}{ncpushbuttono}{ncpushbuttono}{ncpbo} +\pgfcirc@style@to@style{ncpbo}{normally closed push button open} + +\pgfcirc@activate@bipole{l}{toggleswitch}{toggleswitch}{toggle switch} +\pgfcirc@activate@bipole@simple{l}{reed} + +\pgfcirc@activate@bipole{l}{cuteclosedswitch}{cuteclosedswitch}{cute closed switch} +\pgfcirc@style@to@style{cute closed switch}{ccsw} +\pgfcirc@activate@bipole{l}{cuteopenswitch}{cuteopenswitch}{cute open switch} +\pgfcirc@style@to@style{cute open switch}{cosw} +\pgfcirc@activate@bipole{l}{cuteclosingswitch}{cuteclosingswitch}{cute closing switch} +\pgfcirc@style@to@style{cute closing switch}{ccgsw} +\pgfcirc@activate@bipole{l}{cuteopeningswitch}{cuteopeningswitch}{cute opening switch} +\pgfcirc@style@to@style{cute opening switch}{cogsw}% %>>> + %%%%%%%%%%%%%%%%% %% Instruments %%%%%%%%%%%%%%%%% +%% Definitions for Instruments %<<<1 +\ctikzset{bipoles/ammeter/height/.initial=.60} +\ctikzset{bipoles/ammeter/width/.initial=.60} +\ctikzset{bipoles/ohmmeter/height/.initial=.60} +\ctikzset{bipoles/ohmmeter/width/.initial=.60} +\ctikzset{bipoles/voltmeter/height/.initial=.60} +\ctikzset{bipoles/voltmeter/width/.initial=.60} +\ctikzset{bipoles/smeter/height/.initial=.60} +\ctikzset{bipoles/smeter/width/.initial=.60} +\ctikzset{bipoles/smeter/voltage/additional shift/.initial=1} +\ctikzset{bipoles/qmeter/depth/.initial=.40} +\ctikzset{bipoles/qmeter/height/.initial=.80} +\ctikzset{bipoles/qmeter/width/.initial=.60} +% this must be specified for each one +\ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/iloop/width/.initial=.40} +\ctikzset{bipoles/iloop/height/.initial=.60} + +\ctikzset{bipoles/oscope/height/.initial=.60} +\ctikzset{bipoles/oscope/width/.initial=.60} +\ctikzset{bipoles/oscope/voltage/additional shift/.initial=1} + + +% option to not rotate the new (Romano's) instruments +\newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue +\pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +\ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +%%>>> + +%% Node shapes for instruments%<<< + % % METERINGSHAPE \long\def\drawmeteringcircle{ \def\pgf@circ@temp{right} @@ -3976,1720 +4960,46 @@ \pgfusepath{draw} \endpgfscope } - - -%% Varistor -\pgfcircdeclarebipolescaled{resistors} -{ - \pgfcirc@border@extend@updown{1}{1.4} -} -{\ctikzvalof{bipoles/varistor/height}} -{varistor} -{\ctikzvalof{bipoles/varistor/height}} -{\ctikzvalof{bipoles/varistor/width}} -{ - \pgfscope - \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}} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgf@circ@draworfill - \endpgfscope - - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} - - \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}} -} - -%%%%%%%%%%%%%% -%% RF bipoles -%%%%%%%%%%%%%% - -% transmission line -\pgfcircdeclarebipolescaled{RF} -{} -{\ctikzvalof{bipoles/tline/height}} -{tline} -{\ctikzvalof{bipoles/tline/height}} -{\ctikzvalof{bipoles/tline/width}} -{ - \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis - \begin{pgftransparencygroup} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgf@circ@draworfill - \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} - {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} - \pgf@circ@draworfill - \end{pgftransparencygroup} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfusepath{stroke} -} - -% microstrip transmission line -\pgfcircdeclarebipolescaled{RF} -{} -{\ctikzvalof{bipoles/mstline/height}} -{mstline} -{\ctikzvalof{bipoles/mstline/height}} -{\ctikzvalof{bipoles/mstline/width}} -{ - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgf@circ@draworfill -} - -%%%%%%%%%%%%%%%%%%% -%% Block diagrams -%%%%%%%%%%%%%%%%%%% - -%% Draw the two-port fillable box -\def\pgf@circ@twoportbox{ - \pgfscope - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgf@circ@draworfill - \endpgfscope -} - -%% Generic two port box -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/twoport/height}} -{twoport} -{\ctikzvalof{bipoles/twoport/height}} -{\ctikzvalof{bipoles/twoport/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - % draw outer box - \pgf@circ@twoportbox - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} - -} - -%% twoport split -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/twoportsplit/width}} -{twoportsplit} -{\ctikzvalof{bipoles/twoportsplit/width}} -{\ctikzvalof{bipoles/twoportsplit/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - %get texts - \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}} - \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}} - - % rotate inner symbol - \def\texti{\pgfcirc@tin} - \def\textii{\pgfcirc@tout} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \def\texti{\pgfcirc@tout} - \def\textii{\pgfcirc@tin} - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \def\texti{\pgfcirc@tout} - \def\textii{\pgfcirc@tin} - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \def\texti{\pgfcirc@tin} - \def\textii{\pgfcirc@tout} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti} - \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii} -} - -%% voltage controled oscillator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/vco/width}} -{vco} -{\ctikzvalof{bipoles/twoport/width}} -{\ctikzvalof{bipoles/vco/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - % draw circle - \pgfscope - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} - \pgf@circ@draworfill - \endpgfscope - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner sine waves - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% bandpass filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/bandpass/width}} -{bandpass} -{\ctikzvalof{bipoles/bandpass/width}} -{\ctikzvalof{bipoles/bandpass/width}} -{ - - \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% bandstop filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/bandstop/width}} -{bandstop} -{\ctikzvalof{bipoles/bandstop/width}} -{\ctikzvalof{bipoles/bandstop/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt}% always draw solid line for inner symbol - \pgfsetarrows{-}%never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% highpass filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/highpass/width}} -{highpass} -{\ctikzvalof{bipoles/highpass/width}} -{\ctikzvalof{bipoles/highpass/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% lowpass filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/lowpass/width}} -{lowpass} -{\ctikzvalof{bipoles/lowpass/width}} -{\ctikzvalof{bipoles/lowpass/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% allpass filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/allpass/width}} -{allpass} -{\ctikzvalof{bipoles/allpass/width}} -{\ctikzvalof{bipoles/allpass/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% ADC -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/adc/width}} -{adc} -{\ctikzvalof{bipoles/adc/width}} -{\ctikzvalof{bipoles/adc/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\texti{A} - \def\textii{D} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \def\texti{D} - \def\textii{A} - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \def\texti{D} - \def\textii{A} - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \def\texti{A} - \def\textii{D} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} - \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} -} - -%% DAC -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/dac/width}} -{dac} -{\ctikzvalof{bipoles/dac/width}} -{\ctikzvalof{bipoles/dac/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\texti{D} - \def\textii{A} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \def\texti{A} - \def\textii{D} - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \def\texti{A} - \def\textii{D} - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \def\texti{D} - \def\textii{A} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} - \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} -} - -%% DSP -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/dsp/width}} -{dsp} -{\ctikzvalof{bipoles/dsp/width}} -{\ctikzvalof{bipoles/dsp/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgftext[center,x=0,y=0]{\textsf{DSP}} -} - -%% FFT -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/fft/width}} -{fft} -{\ctikzvalof{bipoles/fft/width}} -{\ctikzvalof{bipoles/fft/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgftext[center,x=0,y=0]{\textsf{FFT}} -} - -%% Amplifier -\pgfcircdeclarebipolescaled{blocks} -{} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{amp} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \ifpgf@circuit@boxed - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} - \pgf@circ@draworfill - \fi - - % draw input arrow - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - \ifpgf@circuit@boxed - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn - \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box - \else - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \fi - - \pgfsetarrows{-} %never draw arrows - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} - \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} - - \pgfpathclose - \pgf@circ@draworfill - - % draw inner text - \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} -} - - -%% variable amplifier -\pgfcircdeclarebipolescaled{blocks} -{} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{vamp} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \ifpgf@circuit@boxed - \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi - - % draw input arrow - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - \ifpgf@circuit@boxed - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn - \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box - \else - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \fi - - - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} - \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} - - \pgfpathclose - \pgf@circ@draworfill - - % draw inner text - \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} - - % draw arrow - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% pi attenuator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/piattenuator/width}} -{piattenuator} -{\ctikzvalof{bipoles/piattenuator/width}} -{\ctikzvalof{bipoles/piattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% variable pi attenuator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/vpiattenuator/width}} -{vpiattenuator} -{\ctikzvalof{bipoles/vpiattenuator/width}} -{\ctikzvalof{bipoles/vpiattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% T attenuator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/tattenuator/width}} -{tattenuator} -{\ctikzvalof{bipoles/tattenuator/width}} -{\ctikzvalof{bipoles/tattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% variable T attenuator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/vtattenuator/width}} -{vtattenuator} -{\ctikzvalof{bipoles/vtattenuator/width}} -{\ctikzvalof{bipoles/vtattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% phase shifter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/phaseshifter/width}} -{phaseshifter} -{\ctikzvalof{bipoles/phaseshifter/width}} -{\ctikzvalof{bipoles/phaseshifter/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % inner symbol - \pgftext[center,x=0,y=0]{\Large$\varphi$} -} - -%% variable phase shifter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/phaseshifter/width}} -{vphaseshifter} -{\ctikzvalof{bipoles/vphaseshifter/width}} -{\ctikzvalof{bipoles/vphaseshifter/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % inner symbol - \pgftext[center,x=0,y=0]{\Large$\varphi$} - - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% detector -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/detector/width}} -{detector} -{\ctikzvalof{bipoles/detector/width}} -{\ctikzvalof{bipoles/detector/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % draw inner stuff - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{0.8\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} - \pgfusepath{draw} - - \ifpgf@circuit@fulldiode - \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}} - \pgftransformscale{\pgfmathresult} - \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} - \else - \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}} - \pgftransformscale{\pgfmathresult} - \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} - \fi - -} - -%% single phase ac/dc converter -\pgfcircdeclarebipolescaled{blocks} -{ - \anchor{dc1}{ - \northeast - \pgf@y=.4\pgf@y - } - \anchor{dc2}{ - \northeast - \pgf@y=-.4\pgf@y - } -} -{\ctikzvalof{bipoles/sacdc/width}} -{sacdc} -{\ctikzvalof{bipoles/sacdc/width}} -{\ctikzvalof{bipoles/sacdc/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - % draw sin wave - \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - - % draw equal sign - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} - \pgfusepath{draw} -} - - - -%% single phase dc/ac converter -\pgfcircdeclarebipolescaled{blocks} -{ - \anchor{dc1}{ - \northeast - \pgf@y=.4\pgf@y - \pgf@x=-\pgf@x - } - \anchor{dc2}{ - \northeast - \pgf@y=-.4\pgf@y - \pgf@x=-\pgf@x - } -} -{\ctikzvalof{bipoles/sdcac/width}} -{sdcac} -{\ctikzvalof{bipoles/sdcac/width}} -{\ctikzvalof{bipoles/sdcac/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - % draw sin wave - \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - - % draw equal sign - \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} - \pgfusepath{draw} -} - - -%% threephase ac/dc converter -\pgfcircdeclarebipolescaled{blocks} -{ - \anchor{dc1}{ - \northeast - \pgf@y=.4\pgf@y - } - \anchor{dc2}{ - \northeast - \pgf@y=-.4\pgf@y - } - \anchor{ac1}{ - \northeast - \pgf@y=.6\pgf@y - \pgf@x=-\pgf@x - } - \anchor{ac2}{ - \northeast - \pgf@y=0\pgf@y - \pgf@x=-\pgf@x - } - \anchor{ac3}{ - \northeast - \pgf@y=-.6\pgf@y - \pgf@x=-\pgf@x - } -} -{\ctikzvalof{bipoles/tacdc/width}} -{tacdc} -{\ctikzvalof{bipoles/tacdc/width}} -{\ctikzvalof{bipoles/tacdc/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - % draw sin waves - \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - - - - - % draw equal sign - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} - \pgfusepath{draw} -} - - -%% threephase dc/ac converter -\pgfcircdeclarebipolescaled{blocks} -{ - \anchor{dc1}{ - \northeast - \pgf@y=.4\pgf@y - \pgf@x=-\pgf@x - } - \anchor{dc2}{ - \northeast - \pgf@y=-.4\pgf@y - \pgf@x=-\pgf@x - } - \anchor{ac1}{ - \northeast - \pgf@y=.6\pgf@y - } - \anchor{ac2}{ - \northeast - \pgf@y=0\pgf@y - } - \anchor{ac3}{ - \northeast - \pgf@y=-.6\pgf@y - } -} -{\ctikzvalof{bipoles/tdcac/width}} -{tdcac} -{\ctikzvalof{bipoles/tdcac/width}} -{\ctikzvalof{bipoles/tdcac/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - % draw sin waves - \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - - - - - % draw equal sign - \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} - \pgfusepath{draw} -} - +% %>>> + +% Path definitions for Instruments%<<< + +\pgfcirc@activate@bipole@simple{l}{ammeter} +\pgfcirc@activate@bipole@simple{l}{ohmmeter} +\pgfcirc@activate@bipole@simple{l}{voltmeter} +\pgfcirc@activate@bipole@simple{l}{oscope} +\pgfcirc@activate@bipole@simple{l}{rmeter} +\pgfcirc@activate@bipole@simple{l}{rmeterwa} +\pgfcirc@activate@bipole@simple{l}{smeter} +\pgfcirc@activate@bipole@simple{l}{iloop} +% \pgfcirc@activate@bipole@simple{l}{iloop2} that was wrong +\pgfcirc@activate@bipole{l}{ilooptwo}{iloop2}{iloop2} +\pgfcirc@activate@bipole@simple{l}{qvprobe} +\pgfcirc@activate@bipole@simple{l}{qiprobe} +\pgfcirc@activate@bipole@simple{l}{qpprobe} +% %>>> %%%%%%%%%%%%%%%%%%%%%%% %% MECHANICAL SYMBOLS %%%%%%%%%%%%%%%%%%%%%%% +%% Settings for Mechanical section%<<<1 +\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8} +\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6} +\ctikzset{bipoles/spring/height/.initial=.5} +\ctikzset{bipoles/spring/width/.initial=.5} +\ctikzset{bipoles/inerter/height/.initial=.7} +\ctikzset{bipoles/inerter/width/.initial=.175} +\ctikzset{bipoles/mass/height/.initial=.55} +\ctikzset{bipoles/mass/box height/.initial=.4} +\ctikzset{bipoles/mass/width/.initial=.5} + +\ctikzset{bipoles/damper/height/.initial=.35} +\ctikzset{bipoles/damper/length/.initial=.3} +\ctikzset{bipoles/damper/width/.initial=.4} +%%>>> + +%% Node shapes Mechanical analog system%<<< %% mechanical capacitance - stiffness/spring \pgfcircdeclarebipolescaled{mechanicals} @@ -5847,32 +5157,216 @@ \pgfusepath{stroke} } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% electromechanical device (motor/generator) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%% -%% Crossing -%%%%%%%%%%%%%%%% - -%% crossing bipole (but see also nodes) -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/crossing/size}} -{crossing} -{\ctikzvalof{bipoles/crossing/size}} -{\ctikzvalof{bipoles/crossing/size}}{ - \pgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} - \pgfsetbeveljoin - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfusepath{draw} - \endpgfscope +\pgfdeclareshape{elmech} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{% + \@tempdima=\pgf@x\@tempdimb=\pgf@y + \northwest\pgf@circ@res@other=-\pgf@x + \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}} + } + \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x} + \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x} + \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block up right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=-0.5\pgf@x + } + \anchor{block up left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=0.5\pgf@x + } + \anchor{block down right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=-0.5\pgf@x + } + \anchor{block down left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=0.5\pgf@x + } + \behindbackgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope % clip the bar: whole size minus the circle + \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgfseteorule + \pgfusepath{clip} + \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfsetfillcolor{\ctikzvalof{color}} + \pgfusepath{fill, draw} + \endpgfscope + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} + \fi + \endpgfscope + } } +% %>>> + +%% Path definitions for Mechanical%<<< + +\pgf@circ@definetranspath{elmech} +\pgfcirc@activate@bipole@simple{l}{spring} +\pgfcirc@activate@bipole@simple{l}{inerter} +\pgfcirc@activate@bipole@simple{l}{mass} +\pgfcirc@activate@bipole@simple{l}{damper} +\pgfcirc@activate@bipole@simple{l}{viscoe} +% %>>> + %%%%%%%%%%%%%%%%%%%%%%%%% %% Miscellaneous bipoles %%%%%%%%%%%%%%%%%%%%%%%%% +% settings for microphone, loudspeaker, fuses and misc%<<<1 + +\ctikzset{bipoles/loudspeaker/height/.initial=.8} +\ctikzset{bipoles/loudspeaker/depth/.initial=.3} +\ctikzset{bipoles/loudspeaker/width/.initial=.8} +\ctikzset{bipoles/mic/height/.initial=1.2} +\ctikzset{bipoles/mic/depth/.initial=.1} +\ctikzset{bipoles/mic/width/.initial=.8}% + +% arresters, fuses, lamps, etc + +\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} +\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} +\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30} +\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60} +\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60} +\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15} +\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25} +\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45} +\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1} +\ctikzset{bipoles/fuse/height/.initial=.20} +\ctikzset{bipoles/fuse/width/.initial=.50} +\ctikzset{bipoles/afuse/height/.initial=.20} +\ctikzset{bipoles/afuse/width/.initial=.50} +\ctikzset{bipoles/lamp/height/.initial=.60} +\ctikzset{bipoles/lamp/width/.initial=.60} +\ctikzset{bipoles/bulb/height/.initial=.8} +\ctikzset{bipoles/bulb/width/.initial=.8} +\ctikzset{bipoles/tline/height/.initial=.3} +\ctikzset{bipoles/tline/width/.initial=.6} +\ctikzset{bipoles/squid/height/.initial=.60} +\ctikzset{bipoles/squid/width/.initial=.60} +\ctikzset{bipoles/barrier/height/.initial=.60} +\ctikzset{bipoles/barrier/width/.initial=.60} +\ctikzset{bipoles/openbarrier/gap/.initial=0.5} +\ctikzset{bipoles/thermocouple/height/.initial=.250} +\ctikzset{bipoles/thermocouple/height 2/.initial=.60} +\ctikzset{bipoles/thermocouple/width/.initial=.140} +\newif\ifpgf@circuit@europeangfsurgearrester +\ctikzset{gas filled surge arrester choice/.is choice} +\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}} +\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}} + +\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}} +\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}} +%%>>> + +%% Node shapes for miscellaneous symbols %<<< %% loudspeaker and microphone \pgfcircdeclarebipolescaled{misc} @@ -6154,7 +5648,27 @@ \pgfsetbeveljoin \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfusepath{draw} -} - +}% %>>> + +%% Path definitions for Miscellaneous%<<< + +\pgfcirc@activate@bipole@simple{l}{lamp} +\pgfcirc@activate@bipole@simple{l}{bulb} +\pgfcirc@activate@bipole@simple{l}{squid} +\pgfcirc@activate@bipole@simple{l}{barrier} +\pgfcirc@activate@bipole@simple{l}{openbarrier} +\pgfcirc@activate@bipole@simple{l}{thermocouple} +\pgfcirc@activate@bipole@simple{l}{fuse} +\pgfcirc@activate@bipole{l}{afuse}{afuse}{asymmetric fuse} +\pgfcirc@style@to@style{asymmetric fuse}{afuse} +\def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} +\pgfcirc@activate@bipole{l}{europeangfsurgearrester}{european gas filled surge arrester}{european gas filled surge arrester} +\pgfcirc@activate@bipole{l}{americangfsurgearrester}{american gas filled surge arrester}{american gas filled surge arrester} +\pgfcirc@path@to@style{l}{gfsurgearrester}{gas filled surge arrester}{} +\pgfcirc@path@to@style{l}{gfsurgearrester}{gf surge arrester}{} +\pgfcirc@activate@bipole@simple{l}{mic} +\pgfcirc@activate@bipole@simple{l}{loudspeaker} +% %>>> % end of pgfcircbipoles.tex +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex index 3899a1df129..49378d367bf 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -24,7 +24,7 @@ %% Options \ctikzset{i^>/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = above @@ -32,7 +32,7 @@ } \ctikzset{i_>/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = below @@ -40,7 +40,7 @@ } \ctikzset{i>^/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = before, \circuitikzbasekey/bipole/current/y position = above @@ -48,7 +48,7 @@ } \ctikzset{i>_/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = before, \circuitikzbasekey/bipole/current/y position = below @@ -56,7 +56,7 @@ } \ctikzset{i^</.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = above @@ -64,7 +64,7 @@ } \ctikzset{i_</.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = below @@ -72,7 +72,7 @@ } \ctikzset{i<^/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before, \circuitikzbasekey/bipole/current/y position = above @@ -80,7 +80,7 @@ } \ctikzset{i<_/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before, \circuitikzbasekey/bipole/current/y position = below @@ -92,7 +92,7 @@ \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = above } - \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/current/label/name={#1}} \ctikzsetvalof{bipole/current/label/unit}{} \ifpgf@circ@siunitx \pgf@circ@handleSI{#1} @@ -121,13 +121,13 @@ } \ifpgf@circ@oldvoltagedirection - \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward } } + \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward } } \else - \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } } + \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } } \fi -\ctikzset{i_/.style = { i = #1, \circuitikzbasekey/bipole/current/y position = below } } -\ctikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } } -\ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } } +\ctikzset{i_/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = below } } +\ctikzset{i>/.style = {i={#1}, \circuitikzbasekey/bipole/current/direction = forward } } +\ctikzset{i^/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = above } } %% Output routine \def\pgf@circ@drawcurrent{ diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex index 9d72e87d7d4..77d240cef7f 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -25,7 +25,7 @@ %% Options \ctikzset{f^>/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = above @@ -33,7 +33,7 @@ } \ctikzset{f_>/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = below @@ -41,7 +41,7 @@ } \ctikzset{f>^/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = before, \circuitikzbasekey/bipole/flow/y position = above @@ -49,7 +49,7 @@ } \ctikzset{f>_/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = before, \circuitikzbasekey/bipole/flow/y position = below @@ -57,7 +57,7 @@ } \ctikzset{f^</.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = backward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = above @@ -65,7 +65,7 @@ } \ctikzset{f_</.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = backward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = below @@ -73,7 +73,7 @@ } \ctikzset{f<^/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = backward, \circuitikzbasekey/bipole/flow/x position = before, \circuitikzbasekey/bipole/flow/y position = above @@ -81,24 +81,24 @@ } \ctikzset{f<_/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = backward, \circuitikzbasekey/bipole/flow/x position = before, \circuitikzbasekey/bipole/flow/y position = below } } -\ctikzset{f</.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = backward} } -\ctikzset{f_/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = below } } -\ctikzset{f>/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } } -\ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } } +\ctikzset{f</.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = backward} } +\ctikzset{f_/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = below } } +\ctikzset{f>/.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = forward } } +\ctikzset{f^/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = above } } \ctikzset{f/.code = { \pgfcirc@has@ftrue \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = above } - \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/flow/label/name={#1}} \ctikzsetvalof{bipole/flow/label/unit}{} \ifpgf@circ@siunitx \pgf@circ@handleSI{#1} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex index 5f65d770794..465f704ded7 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -31,9 +31,9 @@ }} %% Options -\ctikzset{label/.style = { l=#1 } } +\ctikzset{label/.style = { l={#1} } } \ctikzset{l/.code = { - \pgfkeys{/tikz/circuitikz/bipole/label/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/label/name={#1}} \ctikzsetvalof{bipole/label/unit}{} \ifpgf@circ@siunitx \pgf@circ@handleSI{#1} @@ -49,28 +49,28 @@ }} \ctikzset{label above/.code = { - l=#1, + l={#1}, \circuitikzbasekey/bipole/label/position=90 } } \ctikzset{l^/.style = { - l=#1, + l={#1}, \circuitikzbasekey/bipole/label/position=90 } } \ctikzset{label below/.code = { - l=#1, + l={#1}, \circuitikzbasekey/bipole/label/position=-90 } } \ctikzset{l_/.style = { - l=#1, + l={#1}, \circuitikzbasekey/bipole/label/position=-90 } } -\ctikzset{annotation/.style = { a=#1 } } +\ctikzset{annotation/.style = { a={#1} } } \ctikzset{a/.code = { - \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/annotation/name={#1}} \ctikzsetvalof{bipole/annotation/unit}{} \ifpgf@circ@siunitx \pgf@circ@handleSI{#1} @@ -86,21 +86,21 @@ }} \ctikzset{annotation above/.code = { - a=#1, + a={#1}, \circuitikzbasekey/bipole/annotation/position=90 } } \ctikzset{a^/.style = { - a=#1, + a={#1}, \circuitikzbasekey/bipole/annotation/position=90 } } \ctikzset{annotation below/.code = { - a=#1, + a={#1}, \circuitikzbasekey/bipole/annotation/position=-90 } } \ctikzset{a_/.style = { - a=#1, + a={#1}, \circuitikzbasekey/bipole/annotation/position=-90 } } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex index 5087f696780..08f58c1b706 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -19,6 +19,38 @@ %%%%%%%%%%%%% +% grounds and power supplies%<<<1 + +\ctikzset{monopoles/.is family} +\ctikzset{monopoles/ground/width/.initial=.25} +\ctikzset{monopoles/ground/connectionthickness/.initial=1} +\ctikzset{monopoles/ground/thickness/.initial=2} +\ctikzset{monopoles/rground/thickness/.initial=2} +\ctikzset{monopoles/tground/thickness/.initial=3} +\ctikzset{monopoles/vcc/width/.initial=.2} +\ctikzset{monopoles/vcc/arrow/.initial=legacy} +\ctikzset{monopoles/vee/arrow/.initial=legacy} +\ctikzset{monopoles/match/width/.initial=.4} +\ctikzset{monopoles/chassis/width/.initial=.25} +\ctikzset{monopoles/alternative chassis/width/.initial=.25} +\ctikzset{monopoles/equipotentiality/width/.initial=.25} +\ctikzset{monopoles/antenna/width/.initial=.25} +\ctikzset{monopoles/antenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/antenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/txantenna/width/.initial=.25} +\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/rxantenna/width/.initial=.25} +\ctikzset{monopoles/bareantenna/width/.initial=.25} +\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1} +\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5} +\ctikzset{monopoles/waves/width/.initial=0.5}% +%>>> + +%% Node shapes for grounds and power supply%<<< + %% Ground symbol % #1 -> name % #2 -> width @@ -352,11 +384,77 @@ \pgfusepath{draw} \endpgfscope } +}% %>>> + + +%% This are strange, and probably wrong FIXME +% \compattikzset{vdd/.style = {\comnpatname vcc = #1}} +% \compattikzset{vss/.style = {\comnpatname vee = #1}} +\pgfcirc@style@to@style{vcc}{vdd} +\pgfcirc@style@to@style{vee}{vss} + + +%%%%%%%%%%%%%% +%% RF bipoles and monopoles +%%%%%%%%%%%%%% + +%% RF bipoles and monopoles settings %<<<1 +\ctikzset{bipoles/mstline/height/.initial=0.3} +\ctikzset{bipoles/mstline/width/.initial=1.2} +\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}} +\ctikzset{monopoles/msport/width/.initial=.5} +\ctikzset{monopoles/msrstub/height/.initial=1.0} +\ctikzset{monopoles/msrstub/width/.initial=0.6}% +%>>> + +%% Node shapes for RF bipoles%<<< + +\pgfcircdeclarebipolescaled{RF} +{} +{\ctikzvalof{bipoles/tline/height}} +{tline} +{\ctikzvalof{bipoles/tline/height}} +{\ctikzvalof{bipoles/tline/width}} +{ + \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis + \begin{pgftransparencygroup} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} + \pgf@circ@draworfill + \end{pgftransparencygroup} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{stroke} } -%%%%%%%%%%%%%%%% -%% RF elements -%%%%%%%%%%%%%%%% +% microstrip transmission line +\pgfcircdeclarebipolescaled{RF} +{} +{\ctikzvalof{bipoles/mstline/height}} +{mstline} +{\ctikzvalof{bipoles/mstline/height}} +{\ctikzvalof{bipoles/mstline/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +}% %>>> + +%% Path definitions for RF path objects%<<< +\pgfcirc@activate@bipole@simple{l}{mstline} +\pgfcirc@activate@bipole@simple{l}{tline} +\pgfcirc@style@to@style{tline}{transmission line} +\pgfcirc@style@to@style{tline}{TL} +% %>>> + +%% Node shapes for RF monopoles%<<< % Legacy tlinestub % Contributed by Leonardo Azzinnari @@ -1096,5 +1194,7 @@ \endpgfscope } } +% %>>> \endinput +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex index 315ba32e4e2..3454f6dd344 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -11,9 +11,95 @@ % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Multipoles by Romano Giannetti +%% Chips and Rotary Switches %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Definitions for Chips and Rotary switches (multipoles) %<<<1 +% +\ctikzset{multipoles/thickness/.initial=2} +\ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny} +% DIP (dual in line package) chips +\ctikzset{multipoles/dipchip/width/.initial=1.2} +\ctikzset{multipoles/dipchip/num pins/.initial=8} +\ctikzset{multipoles/dipchip/pin spacing/.initial=0.4} +\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}} +% QFP (quad flat package) chips +\ctikzset{multipoles/qfpchip/num pins/.initial=8} +\ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4} +\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}} +% chip numbers +\newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue +\pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue +\pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +\ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +% external chip pins +\ctikzset{multipoles/external pins thickness/.initial=1} +\ctikzset{multipoles/external pins width/.initial=0.2} +\ctikzset{multipoles/external pad fraction/.initial=0} +\pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}} +\pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}} +% topmarks +\newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue +\pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} +\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} + +% rotary switch by Romano +\ctikzset{multipoles/rotary/thickness/.initial=1} +\ctikzset{multipoles/rotary/shape/.initial=ocirc} +\ctikzset{multipoles/rotary/channels/.initial=5} +\ctikzset{multipoles/rotary/angle/.initial=60} +\ctikzset{multipoles/rotary/wiper/.initial=20} +\ctikzset{multipoles/rotary/arrow/.is choice} +\newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse +\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse +\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse +\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}} +\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}} + +\tikzset{% + rotary switch/.style args={#1in#2wiper#3}{% + shape=rotaryswitch, + /tikz/circuitikz/multipoles/rotary/channels=#1, + /tikz/circuitikz/multipoles/rotary/angle=#2, + /tikz/circuitikz/multipoles/rotary/wiper=#3, + }, + rotary switch -/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=none, + }, + rotary switch <-/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=ccw, + }, + rotary switch ->/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=cw, + }, + rotary switch <->/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=both, + }, + % Notice that these should be the same as the initial values of the keys + rotary switch/.default={5 in 60 wiper 20}, + rotary switch -/.default={5 in 60 wiper 20}, + rotary switch <-/.default={5 in 60 wiper 20}, + rotary switch ->/.default={5 in 60 wiper 20}, + rotary switch <->/.default={5 in 60 wiper 20}, +} +%%>>> + +%% Nodes definitions for chips%<<< + %%%%%%%%% %% Chips %%%%%%%%% @@ -523,7 +609,9 @@ % <= npins/4, left side \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}% \fi -} +}% %>>> + +%% Nodes definition for rotaryswitch%<<< %%%%%%%%%%%%%%%%% %% Rotary Switch @@ -713,12 +801,87 @@ \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}} \advance\pgf@x by -\pgf@circ@res@temp -} +}% %>>> %%%%%%%%%%%%%%%%%%%%%%%%%% % Seven segments displays %%%%%%%%%%%%%%%%%%%%%%%%%% +% Definitions for seven segment displays by RGtti%<<<1 + +\newif\ifpgf@circ@sevenseg@dot +\newif\ifpgf@circ@sevenseg@box +\def\pgf@circ@sevenseg@dotstate{empty} +\ctikzset{seven seg/.is family} +\ctikzset{seven seg/dot/.is choice} +% none means no dot, not space for it. Empty means no dot, but space +\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}} +\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} +\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} +\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} +% +\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen +\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness +\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments +\ctikzset{seven seg/box sep/.initial=1pt}% external box gap +\ctikzset{seven seg/color on/.initial=red}% color for segment "on" +\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" +\ctikzset{seven seg/box/.is choice} +\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}} +\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}} + +\ctikzset{seven seg/bits/.initial=0000000} + +\ctikzset{seven seg/value/.code={% + \edef\@@tmp{#1}% + \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi + \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi + \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi + \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi + \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi + \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi + \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi + \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi + \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi + \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi + \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi +}} + +\tikzset{% + seven segment val/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/value=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, + seven segment bits/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/bits=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, +} +%%>>> + +%% Nodes definitions for 7-segment display%<<< \pgfdeclareshape{bare7seg}{ \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}} \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} @@ -857,11 +1020,39 @@ \pgfusepath{draw,fill} \fi } +% %>>> + +%%%%%%%%%%%%%%%%%%%%%%%% +%% Flip-flops and muxdemuxes +%%%%%%%%%%%%%%%%%%%%%%%% +% Settings for flip flops and muxdemxes%<<<1 -%%%%%% -%%%%%% Flip-flops -%%%%%% +%% flip-flop specific keys (most others are the same as chips) + +\ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small} +\ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny} +\ctikzset{multipoles/flipflop/width/.initial=1.2} +\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6} +\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2} + +%% muxdemuxes keys + +\ctikzset{multipoles/muxdemux/base len/.initial=0.4} +\ctikzset{multipoles/muxdemux/Lh/.initial=8.0} +\ctikzset{multipoles/muxdemux/Rh/.initial=6.0} +\ctikzset{multipoles/muxdemux/w/.initial=3.0} +\ctikzset{multipoles/muxdemux/inset w/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0} +\ctikzset{multipoles/muxdemux/NL/.initial=8} +\ctikzset{multipoles/muxdemux/NR/.initial=1} +\ctikzset{multipoles/muxdemux/NB/.initial=3} +\ctikzset{multipoles/muxdemux/NT/.initial=0} +\ctikzset{multipoles/muxdemux/square pins/.initial=0}% +%>>> + +%% Node shapes definitions for flip flops%<<< % Flip flops are a specialized kind of dipchip. % they have a class by themselves @@ -1293,6 +1484,9 @@ \repeatpgfmathloop% }% } +% %>>> + +%% Node shapes for mux-demuxes%<<< % % MUX-DEMUXES @@ -1781,1247 +1975,6 @@ \fi \fi } +% %>>> -%% IEEE standard logic ports module -%% -%% Original multi-input code from John Kormylo at tex.stackexchange.com -%% Help by TheTeXnician <38565529+TheTeXnician@users.noreply.github.com> -%% Suggested idea and example code by Jason Sachs <jmsachs@gmail.com> -%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details -%% Most of the code, all errors and bugs by Romano Giannetti <romano.giannetti@gmail.com> -%% Everything is in the same place here --- more or less; first step to move towards -%% a module interface for circutikz -%% - -% base parameters for ieeestd ports. - -\ctikzset{ieeestd ports/.is family} -% baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so. -% the value of 0.4 is the standard pin distance for a port with height=num pins -% and matches the chip distance -\ctikzset{ieeestd ports/baselen/.initial=0.4} -% these are in term of baselen; width depends on height (fixed proportions) -\ctikzset{ieeestd ports/height/.initial=2} -\ctikzset{ieeestd ports/pin length/.initial=0.7} -% the standard "not" circle should be 1/6.5 of height (diameter); -% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole -\ctikzset{ieeestd ports/not radius/.initial=0.154} -\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why -% the suggested xnor distance is is 1.24, so 1.25/3.25/2 -% xor/xnor leads go full in in IEEE; let this be optional -\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}% -\ctikzset{ieeestd ports/xor leads in/.initial=1}% -% -% base size of a small external schmitt symbol -% -\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}% -% -% input management -% we are using the same /tikz/number inputs than the legacy ports -% -\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner -% -% integrate with the other logic ports -% -% -\newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse -\ctikzset{logic ports/ieee/.code= {% - \pgf@circuit@ieeelogicporttrue - \pgf@circuit@europeanlogicportfalse - \tikzset{and port/.style={shape=ieeestd and port}}% - \tikzset{or port/.style={shape=ieeestd or port}}% - \tikzset{xor port/.style={shape=ieeestd xor port}}% - \tikzset{buffer port/.style={shape=ieeestd buffer port}}% - \tikzset{not port/.style={shape=ieeestd not port}}% - \tikzset{nand port/.style={shape=ieeestd nand port}}% - \tikzset{nor port/.style={shape=ieeestd nor port}}% - \tikzset{xnor port/.style={shape=ieeestd xnor port}}% - \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}% - \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}% -}} -% add code to be compatible with the other ports -\ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}} -\ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}} -\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}} -% -% the base angle for the or port. See the drawings. This will not change with height -% -\pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)} -% \typeout{ANGLE-IS\space\pgf@circ@orangle} -\def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter -{% - \ifnum#1>\inputs - \PackageError{circuitikz}{% - You requested input pin #1 for logic port shape \thisshape\space \MessageBreak - which has been defined with \inputs\space pins% - }{Please check the manual about logic ports; if you press return I'll try to continue} - \fi - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgf@circ@res@step=\pind - \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax - \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen -}% - -% #1 = \pgfmathcounter #2=type -% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor -\def\pgf@circ@ieeeport@baseinput#1#2% -{% - \ifnum#1>\inputs - \PackageError{circuitikz}{% - You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak - which has been defined with \inputs\space pins% - }{Please check the manual about logic ports; if you press return I'll try to continue} - \fi - % Find the vertical position (this is the same for any port) - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port - \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax - % rack (extended) pins; they are the same for all the ports - % call K = (inputs-inner)/2, rounded up; pins on the rack are: - % above: 1..K (included) - % below: inputs-K..inputs - % Find the pins on the rack; they are 1... - \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! - \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 - % border anchors for rack should be ok - \pgfextractx{\pgf@circ@res@left}{\topleft} - \pgfextractx{\pgf@circ@res@right}{\bodyleft} - \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left - % we have finished if we are in the rack - \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b - % we are on the inner ports; we have to do the hard work here - % and and nand - \ifnum #2=1 - \relax % It's an and/nand, all border ports are on the rack line - \fi - % or and nor - \ifnum #2=2 - \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} - \fi - % xor and xnor - \ifnum #2=3\relax - \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} - \fi - \fi\fi -}% -% inner base ports for xor types port -% #1 = \pgfmathcounter #2=type -% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor -\def\pgf@circ@ieeeport@innerbaseinput#1% -{% - \ifnum#1>\inputs - \PackageError{circuitikz}{% - You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak - which has been defined with \inputs\space pins% - }{Please check the manual about logic ports; if you press return I'll try to continue} - \fi - % Find the vertical position (this is the same for any port) - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port - \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax - % rack (extended) pins; they are the same for all the ports - % call K = (inputs-inner)/2, rounded up; pins on the rack are: - % above: 1..K (included) - % below: inputs-K..inputs - % Find the pins on the rack; they are 1... - \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! - \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 - % border anchors for rack should be ok - \pgfextractx{\pgf@circ@res@left}{\topleft} - \pgfextractx{\pgf@circ@res@right}{\bodyleft} - \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left - % we have finished if we are in the rack - \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b - % we are on the inner ports; we have to do the hard work here - \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} - \fi\fi -}% - -%%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp -\def\pgf@circ@ieeestd@baselen{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen} -} -\def\pgf@circ@ieeestd@stdH{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}* - \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen} -} -\def\pgf@circ@ieeestd@pinlen{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* - \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen} -} -\def\pgf@circ@ieeestd@xorbar{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* - \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen} -} -%% Not circle -\def\pgf@circ@notradius{ - \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE - \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp} - % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp} -} -%% Find (in ...@other) the height of the rack -\def\pgf@circ@findrackH{% - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% - \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% - \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins - \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % - \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% - \pgf@circ@ieeestd@stdH - \multiply\pgf@circ@res@temp by 2\relax% full height - \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing - \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port - % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other} -} -%% -\def\pgf@circ@find@ieeeport@up{% leave it in up - % Normal port limits - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp} - % rack top size - \pgf@circ@findrackH - \ifdim\pgf@circ@res@other > \pgf@circ@res@up - \pgf@circ@res@up=\pgf@circ@res@other - \else - \fi -} -\def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type - % Normal port limits - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5} - \pgf@circ@res@right=\pgf@circ@res@left % save the border value - \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value - \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp - % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - % this is the normal left border - % For the or or xor port, the limit can be the pointy thing (in case the - % pinlen is zero or too small) - % add to the body margin the or/nor peak: - \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates. - \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))} - \advance\pgf@circ@res@right by \pgf@circ@res@other - % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - \fi - % add to the body margin the xor/xnor distance - \ifnum #1 = 3\relax% "xor" or "xnor" gates. - \pgf@circ@ieeestd@xorbar - \advance\pgf@circ@res@right by \pgf@circ@res@temp - % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - \fi - % and if this exceeds the normal margin, this is it - % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - \ifdim \pgf@circ@res@right > \pgf@circ@res@left - \pgf@circ@res@left=\pgf@circ@res@right - \fi - % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - \pgf@circ@res@left=-\pgf@circ@res@left -} -\def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated - % Normal port limits - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5} - \pgf@circ@notradius - \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} - \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp - \ifdim\pgf@circ@res@other > \pgf@circ@res@right - \pgf@circ@res@right=\pgf@circ@res@other - \fi -} -\def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated - % Normal port limits - \pgf@circ@ieeestd@stdH - % notice 0.8660254 is cos(30) - \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp} - \pgf@circ@notradius - \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} - \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp - \ifdim\pgf@circ@res@other > \pgf@circ@res@right - \pgf@circ@res@right=\pgf@circ@res@other - \fi -} - - -%%% ieeestd multi-input ports -%%% #1: name -%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor -%%% #3: polarity: 0 for direct, 1 for inverted (not at the output) -%%% #4: drawing for the port -\long\def\pgfcircdeclareieeeport#1#2#3#4{% - \pgfdeclareshape{ieeestd #1 port}% - {% - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} - \saveddimen{\baselen}{% - \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\stdH}{% This is HALF the height of the inner port - \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\notdiameter}{ - \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp - } - \saveddimen{\pind}{% pin distance; - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% - \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% - \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins - \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % - \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% - \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height - \divide\pgf@x by \pgf@circ@count@b - } - \saveddimen{\pinlen}{% - \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\xorbar}{% - \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp - } - % anchors for the body (no pins included here) - \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\topleft}{% - \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar - \pgf@circ@ieeestd@stdH - \pgf@circ@res@other=0pt\relax - \ifnum #2 = 2\relax% "or" or "nor" gates. - \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))} - \fi - \ifnum #2 = 3\relax% "xor" or "xnor" gates. - \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle)) - +\pgf@circ@res@right} - \fi - \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5} - \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} - } - \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle - \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp - \pgf@circ@ieeestd@stdH - % #3 is =1 if the port is a negated output one - \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other} - \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} - } - % geographical anchors --- must be rectangulars! - \savedanchor{\northwest}{% - \pgf@circ@find@ieeeport@up - \pgf@circ@find@ieeeport@left{#2} - % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up} - \pgf@x=\pgf@circ@res@left - \pgf@y=\pgf@circ@res@up - } - \savedanchor{\southwest}{% - \pgf@circ@find@ieeeport@up - \pgf@circ@find@ieeeport@left{#2} - \pgf@x=\pgf@circ@res@left - \pgf@y=-\pgf@circ@res@up - } - \savedanchor{\southeast}{% - \pgf@circ@find@ieeeport@up - \pgf@circ@find@ieeeport@right{#3} - \pgf@x=\pgf@circ@res@right - \pgf@y=-\pgf@circ@res@up - } - \savedanchor{\northeast}{% - \pgf@circ@find@ieeeport@up - \pgf@circ@find@ieeeport@right{#3} - \pgf@x=\pgf@circ@res@right - \pgf@y=\pgf@circ@res@up - } - \savedmacro\inputs{% get number of inputs - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax - \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default - \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins - % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi - \def\inputs{\the\pgf@circ@count@a}% - }% - \savedmacro\inners{% get number of "inner" inputs (for racks) - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax - \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax - \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins - \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins - \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi - % \typeout{INNER is \the\pgf@circ@count@b}% - % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi - \def\inners{\the\pgf@circ@count@b}% - }% - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \ifpgf@circ@center@text - \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \else - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border - \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \fi - } - % create input anchors - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{% - \pgf@circ@count@a=\inputs - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@circ@count@a% - \else% - %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{% - \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above - }% - \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{% - \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above - }% - \ifnum #2 = 3\relax % xor/xnor inner border pins - \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{% - \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above - }% - \fi - %}{}% - \repeatpgfmathloop% - } - % output anchor - \anchor{out}{% - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball - \advance\pgf@circ@res@other by\pinlen - \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border - \ifdim \pgf@circ@res@temp > \pgf@circ@res@other - \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... - \fi - \pgf@x=\pgf@circ@res@other\pgf@y=0pt - } - \anchor{bout}{\bottomright\pgf@y=0pt} - - \anchor{body right}{\bodyright\pgf@y=0pt} - \anchor{right}{\bottomright\pgf@y=0pt} - \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body - \anchor{left}{% central edge of the component - \bodyleft\pgf@y=0pt - \ifnum #2=3\relax - \advance\pgf@x by -\xorbar - \fi - } - \anchor{up}{% - \bodyleft - \ifnum #2 > 1 % pointy shapes - \pgf@circ@ieeestd@stdH - % horizontal coordinate where the right semicircle starts - \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} - % vertical drop of the circle at the above coordinate - \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} - \advance \pgf@y by -\pgf@circ@res@step - \fi - \pgf@x=0pt - } - \anchor{down}{% - \bodyleft - \ifnum #2 > 1 % pointy shapes - \pgf@circ@ieeestd@stdH - % horizontal coordinate where the right semicircle starts - \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} - % vertical drop of the circle at the above coordinate - \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} - \advance \pgf@y by -\pgf@circ@res@step - \fi - \pgf@y=-\pgf@y\pgf@x=0pt - } - - % geographical anchors - \anchor{nw}{\northwest} - \anchor{ne}{\northeast} - \anchor{se}{\southeast} - \anchor{sw}{\southwest} - \anchor{north west}{\northwest} - \anchor{north east}{\northeast} - \anchor{south east}{\southeast} - \anchor{south west}{\southwest} - % over 0,0 even if asymmetric - % will break if the geocoords are not rectangular - \anchor{n}{\northwest\pgf@x=0pt\relax} - \anchor{e}{\northeast\pgf@y=0pt\relax} - \anchor{s}{\southwest\pgf@x=0pt\relax} - \anchor{w}{\northwest\pgf@y=0pt\relax} - \anchor{north}{\northwest\pgf@x=0pt\relax} - \anchor{east}{\northeast\pgf@y=0pt\relax} - \anchor{south}{\southwest\pgf@x=0pt\relax} - \anchor{west}{\northwest\pgf@y=0pt\relax} - - \backgroundpath{ - \pgfscope - \pgfsetcolor{\ctikzvalof{color}} - #4 - \endpgfscope - % output lead: - \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball - \advance\pgf@circ@res@other by \pinlen\relax - \ifdim \pgf@circ@res@other > \pgf@circ@res@right - \ifpgfcirc@draw@output@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} - \fi - \fi - \ifnum #3=1\relax\pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} - \endpgfscope\fi - } - } -} - -%%% #1 direct name #2 negated name #3 type #4 drawing (without output) -\long\def\pgfcircdeclareieeeportpair#1#2#3#4{% - \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct - \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated -} -% -% ieeestd "and" and "nand" -% -\pgfcircdeclareieeeportpair{and}{nand}{1}{% - \pgf@circ@count@a = \inputs\relax - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port - \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@down}{\bodyleft} - \ifpgfcirc@draw@input@leads - %input leads --- all the same for AND ports - \loop\ifnum\pgf@circ@count@a>0 - \advance\pgf@circ@res@temp by -\pind - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% - \advance\pgf@circ@count@a by -1 - \repeat - \fi - \pgfusepath{draw} - %% Body. let's start from the top left - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} - \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}} - \pgfpatharc{90}{-90}{\stdH} - \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}} - \pgfpathclose - \pgf@circ@draworfill - % rack now; skip if not needed. - % \typeout{WHAT\space \inputs\space \inners} - \ifnum\inputs>\inners - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - \fi - \endpgfscope -} -% -% or/nor and xor/xnor are practically the same. Let factor out everything -% the argument #1 is put just before the drawing of the inner pins -% the argument #2 is put after the drawing of the body -% -\long\def\pgf@circ@ieeeport@orxor#1#2{% - \pgf@circ@count@a = \inputs\relax - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port - \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@down}{\bodyleft} - % rack (extended) pins; they are the same for all the ports - % call K = (inputs-inner)/2, rounded up; pins on the rack are: - % above: 1..K (included) - % below: inputs-K..inputs - % Find the pins on the rack; they are 1... - \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! - \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1 - \ifpgfcirc@draw@input@leads - %input leads --- for or ports - \loop\ifnum\pgf@circ@count@a>0 - \pgfextractx{\pgf@circ@res@right}{\topleft} - \advance\pgf@circ@res@temp by -\pind - % this is the height; let's find the "right" position - \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c - % inner pins - % \typeout{INNER\space\pgf@circ@count@a} - \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))} - % hook for xor/xnor - #1 - \fi\fi - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}% - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% - \pgfusepath{draw} - \advance\pgf@circ@count@a by -1 - \repeat - \fi - %% Body. let's start from the top left - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - % it should start here, but with this trick the close comes out better. - % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} - \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} - \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} % - \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}} - \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}} - \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} - %% this should be 2 and 2; but the round part is not a perfect circle that way - %% so the 2.15 is ajusted "by taste" to touch the anchors exactly. - \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} - \pgfpathclose - \pgf@circ@draworfill - % hook for xor/xnor - #2 - % rack now; skip if not needed. - % \typeout{WHAT\space \inputs\space \inners} - \ifnum\inputs>\inners - \pgfextractx{\pgf@circ@res@left}{\topleft} - \pgfextracty{\pgf@circ@res@down}{\topleft} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - \fi - \endpgfscope -} -% -% ieeestd "or" and "nor" -% -\pgfcircdeclareieeeportpair{or}{nor}{2}{% - \pgf@circ@ieeeport@orxor{}{} -} -\pgfcircdeclareieeeportpair{xor}{xnor}{3}{% - \pgf@circ@ieeeport@orxor{ - \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}} - \ifnum\@@tmp=0\relax - % move pin start to the left to leave the xor gap free (not standard) - \advance\pgf@circ@res@right by -\xorbar - \fi - }{% - % add the xor/xnor bar - \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} - % see the comment on the main body about the 2.2 - \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} - \pgfusepath{draw} - } -} -% -% Buffer and inverters -% -% #1: name -% #2: polarity -% #3: content -\long\def\pgfcircdeclareieeebufferport#1#2#3{% - \pgfdeclareshape{ieeestd #1 port}% - {% - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} - \saveddimen{\baselen}{% - \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\stdH}{% This is HALF the height of the inner port - \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\notdiameter}{ - \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp - } - \saveddimen{\pinlen}{% - \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp - } - % anchors for the body (no pins included here) - % Notice that 0.8660254 is cos(30) - \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\topleft}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle - \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp - \pgf@circ@ieeestd@stdH - % #2 is =1 if the port is a negated output one - \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other} - \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} - } - % geographical anchors --- must be rectangulars! - \savedanchor{\northwest}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\southwest}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} - } - \savedanchor{\southeast}{% - \pgf@circ@ieeestd@stdH - \pgf@circ@res@up=\pgf@circ@res@temp - \pgf@circ@find@ieeeport@not@right{#2} - \pgf@x=\pgf@circ@res@right - \pgf@y=-\pgf@circ@res@up - } - \savedanchor{\northeast}{% - \pgf@circ@ieeestd@stdH - \pgf@circ@res@up=\pgf@circ@res@temp - \pgf@circ@find@ieeeport@not@right{#2} - \pgf@x=\pgf@circ@res@right - \pgf@y=\pgf@circ@res@up - } - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \ifpgf@circ@center@text - \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \else - \pgf@circ@ieeestd@stdH - \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \fi - } - % input anchors - \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} - \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} - \anchor{bin}{\bodyleft\pgf@y=0pt\relax} - \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} - % output anchors - \anchor{out}{% - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball - \advance\pgf@circ@res@other by\pinlen - \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border - \ifdim \pgf@circ@res@temp > \pgf@circ@res@other - \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... - \fi - \pgf@x=\pgf@circ@res@other\pgf@y=0pt - } - \anchor{bout}{\bottomright\pgf@y=0pt} - - \anchor{body right}{\bodyright\pgf@y=0pt} - \anchor{right}{\bottomright\pgf@y=0pt} - \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body - \anchor{left}{\bodyleft\pgf@y=0pt} - \anchor{up}{% - \bodyleft - \pgf@y=+0.5\pgf@y\pgf@x=0pt - } - \anchor{down}{% - \bodyleft - \pgf@y=-0.5\pgf@y\pgf@x=0pt - } - % this is for when it's used as a bipole - % we use the enclosing rectangle (see below) - \anchorborder{% - %% This (commented out) is the correct border anchor. But if we use the correct - %% border anchor there is no horizontal space for the label ;-) because - %% the triangle is too steep. So we will use a simple square border - %% - %% find the border anchor of a triangle (like a not port or an - %% amplifier) --- - %% - %% -----^ up - %% I --- | - %% I -|-- - %%left I | --- right - %% ----I-----|-------I----- - %% - %% - %\pgf@xa=\pgf@x - %% it's simmetrical w/ vertical side, use only positive y - %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} - %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} - %\pgfextracty{\pgf@circ@res@up}{\bodyleft} - %\pgfextractx{\pgf@circ@res@left}{\bodyleft} - %\pgfextractx{\pgf@circ@res@right}{\bodyright} - %% limit angle for the left (vertical) side - %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)} - %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)} - %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)} - %% find the border - %\ifnum\@@leftside>0 - % % vertical side - % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} - % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - %\else - % % triangle upper line - % \pgfpointintersectionoflines - % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} - % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}} - %\fi - %% readjust y sign - %\pgf@y=\@@switchy\pgf@y - % - % this is the square border to position the path label with a bit of horizontal space - % - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} - {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - } - % geographical anchors - \anchor{nw}{\northwest} - \anchor{ne}{\northeast} - \anchor{se}{\southeast} - \anchor{sw}{\southwest} - \anchor{north west}{\northwest} - \anchor{north east}{\northeast} - \anchor{south east}{\southeast} - \anchor{south west}{\southwest} - % over 0,0 even if asymmetric - % will break if the geocoords are not rectangular - \anchor{n}{\northwest\pgf@x=0pt\relax} - \anchor{e}{\northeast\pgf@y=0pt\relax} - \anchor{s}{\southwest\pgf@x=0pt\relax} - \anchor{w}{\northwest\pgf@y=0pt\relax} - \anchor{north}{\northwest\pgf@x=0pt\relax} - \anchor{east}{\northeast\pgf@y=0pt\relax} - \anchor{south}{\southwest\pgf@x=0pt\relax} - \anchor{west}{\northwest\pgf@y=0pt\relax} - - \backgroundpath{ - \pgfscope - \pgfsetcolor{\ctikzvalof{color}} - #3 - \endpgfscope - % output lead: - \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball - \advance\pgf@circ@res@other by \pinlen\relax - \ifdim \pgf@circ@res@other > \pgf@circ@res@right - \ifpgfcirc@draw@output@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} - \fi - \fi - \ifnum #2=1\relax\pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} - \endpgfscope\fi - } - } -} - -%%% #1 direct name #2 negated name #3 drawing (without output) -\long\def\pgfcircdeclareieeebufferportpair#1#2#3{% - \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct - \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated -} - -\pgfcircdeclareieeebufferportpair{buffer}{not}{% - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@right}{\bodyright} - % \draw input pin - \ifpgfcirc@draw@input@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} - \pgfusepath{draw} - \fi - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope -} - -\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{% - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@right}{\bodyright} - % \draw input pin - \ifpgfcirc@draw@input@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} - \pgfusepath{draw} - \fi - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - % draw schmitt symbol in normal line thickness - \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} - \pgfusepath{draw} -} - - -\pgfdeclareshape{schmitt symbol}{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@circ@ieeestd@stdH - \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp - \pgf@x=-1.5\pgf@y - } - \anchor{center}{\pgf@y=0pt \pgf@x=0pt} - \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} - \anchor{west}{\northwest\pgf@y=0pt} - \anchor{w}{\northwest \pgf@y=0pt} - \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} - \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} - \anchor{north}{\northwest\pgf@x=0pt} - \anchor{n}{\northwest\pgf@x=0pt} - \anchor{south west}{\northwest\pgf@y=-\pgf@y} - \anchor{north east}{\northwest\pgf@x=-\pgf@x} - \anchor{north west}{\northwest} - \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} - \backgroundpath{ - \pgfscope - \pgfsetcolor{\ctikzvalof{color}} - \pgfextractx{\pgf@circ@res@left}{\northwest} - \pgfextracty{\pgf@circ@res@up}{\northwest} - \pgf@circ@res@left=0.7\pgf@circ@res@left - \pgf@circ@res@up=0.7\pgf@circ@res@up - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - } -} - -\pgfdeclareshape{notcirc}{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@circ@notradius - \pgf@y=\pgf@circ@res@temp - \pgf@x=-\pgf@y - } - \anchor{center}{\pgf@y=0pt \pgf@x=0pt} - \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} - \anchor{left}{\northwest\pgf@y=0pt} - \anchor{west}{\northwest\pgf@y=0pt} - \anchor{w}{\northwest \pgf@y=0pt} - \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} - \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} - \anchor{north}{\northwest\pgf@x=0pt} - \anchor{n}{\northwest\pgf@x=0pt} - \anchor{south west}{\northwest\pgf@y=-\pgf@y} - \anchor{north east}{\northwest\pgf@x=-\pgf@x} - \anchor{north west}{\northwest} - \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} - \anchorborder{ - \pgf@circ@res@left=\pgf@x - \pgf@circ@res@up=\pgf@y - \northwest\pgf@circ@res@temp=\pgf@y - \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}% - {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - } - \behindforegroundpath{ - \pgfscope - \northwest\pgf@circ@res@temp=\pgf@y - \pgfsetcolor{\ctikzvalof{color}} - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp} - \ifx\tikz@fillcolor\pgfutil@empty - % set the default fill color to white - \pgfsetfillcolor{white} - % ...but override it if the class is defined! - \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} - \else - \pgfsetfillcolor{\tikz@fillcolor} - \fi - \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0 - \pgfusepath{draw,fill} - \endpgfscope - } -} - -%%%% Transmission gates -% tgates are only ieee style for now -\tikzset{% - tgate/.style ={shape=ieee tgate}, - double tgate/.style ={shape=ieee double tgate}, -} -\ctikzset{tgate scale/.initial=0.7} -% Buffer and inverters -% -% #1: name -% #2: 1: one-not, 2:double-not -% #3: content -\long\def\pgfcircdeclareieeetgate#1#2#3{% - \pgfdeclareshape{ieee #1}% - {% - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} - \saveddimen{\baselen}{% - \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\stdH}{% This is HALF the height of the inner port - \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\notdiameter}{ - \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp - } - \saveddimen{\notradius}{ - \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\pinlen}{% - \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp - } - % anchors for the body (no pins included here) - % Notice that 0.8660254 is cos(30) - \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\topleft}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\bodyright}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\bottomright}{% Here it is the same as \bodyright - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - % geographical anchors --- must be rectangulars! - \savedanchor{\northwest}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\southwest}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\southeast}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\northeast}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \ifpgf@circ@center@text - \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \else - \pgf@circ@ieeestd@stdH - \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \fi - } - % input anchors - \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} - \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} - \anchor{bin}{\bodyleft\pgf@y=0pt\relax} - \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} - % gates - \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y - \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} - \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y - \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}} - % gate (up) (2.1547 = 1+1/cos(30) - \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y - \pgf@x=0pt\relax - \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} - \ifdim\pinlen>\pgf@circ@res@temp - \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen} - \else - \pgf@y=\pgf@circ@res@temp - \fi - } - \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y - \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}} - - % output anchors - \anchor{out}{% - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball - \advance\pgf@circ@res@other by\pinlen - \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border - \ifdim \pgf@circ@res@temp > \pgf@circ@res@other - \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... - \fi - \pgf@x=\pgf@circ@res@other\pgf@y=0pt - } - \anchor{bout}{\bottomright\pgf@y=0pt} - - \anchor{body right}{\bodyright\pgf@y=0pt} - \anchor{right}{\bottomright\pgf@y=0pt} - \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body - \anchor{left}{\bodyleft\pgf@y=0pt} - \anchor{up}{% - \bodyleft - \pgf@x=0pt - \ifnum#2=1\relax - \pgf@y=0pt - \else - \pgf@y=.5\pgf@y - \fi - \advance\pgf@y by \notdiameter - } - \anchor{down}{% - \bodyleft - \pgf@x=0pt - \ifnum#2=1\relax - \pgf@y=0pt - \else - \pgf@y=-.5\pgf@y - \fi - } - % this is for when it's used as a bipole - % we use the enclosing rectangle (see below) - \anchorborder{% - % - % this is the square border to position the path label with a bit of horizontal space - % - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} - {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - } - % geographical anchors - \anchor{nw}{\northwest} - \anchor{ne}{\northeast} - \anchor{se}{\southeast} - \anchor{sw}{\southwest} - \anchor{north west}{\northwest} - \anchor{north east}{\northeast} - \anchor{south east}{\southeast} - \anchor{south west}{\southwest} - % over 0,0 even if asymmetric - % will break if the geocoords are not rectangular - \anchor{n}{\northwest\pgf@x=0pt\relax} - \anchor{e}{\northeast\pgf@y=0pt\relax} - \anchor{s}{\southwest\pgf@x=0pt\relax} - \anchor{w}{\northwest\pgf@y=0pt\relax} - \anchor{north}{\northwest\pgf@x=0pt\relax} - \anchor{east}{\northeast\pgf@y=0pt\relax} - \anchor{south}{\southwest\pgf@x=0pt\relax} - \anchor{west}{\northwest\pgf@y=0pt\relax} - - \backgroundpath{ - \pgfscope - \pgfsetcolor{\ctikzvalof{color}} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@right}{\bodyright} - % \draw input pins - \ifpgfcirc@draw@input@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} - % gate (down) - \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} - % gate (up) (2.1547 = 1+1/cos(30) - \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} - \ifdim\pinlen>\pgf@circ@res@temp - \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}} - \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}} - \fi - \pgfusepath{draw} - \fi - #3 - \endpgfscope - % output lead: - \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball - \advance\pgf@circ@res@other by \pinlen\relax - \ifdim \pgf@circ@res@other > \pgf@circ@res@right - \ifpgfcirc@draw@output@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} - \fi - \fi - } - } -} - -\pgfcircdeclareieeetgate{tgate}{1}{% - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - \pgfscope - % 1.1547 is 1/cos(30) - \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}} - \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} - \endpgfscope -} - -\pgfcircdeclareieeetgate{double tgate}{2}{% - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - % bottom triangles - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - \pgfscope - % 1.1547 is 1/cos(30) - \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}} - \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} - \endpgfscope -} - +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex index 0c2df7cd700..eadf5fd117c 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -21,9 +21,9 @@ } % Names -\ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@ +\ctikzset{name/.style = { n={#1} } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@ \ctikzset{n/.code = { - \pgfkeys{/tikz/circuitikz/bipole/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/name={#1}} }} % Reflect the node along @@ -97,22 +97,6 @@ % \pgf@circ@bipole@path@base{shape}{}{#1}{#2} } -% -% this is used for components that are mainly node-style but have a path-style form -% -\def\pgfcirc@node@to@path#1#2#3{% - % add a path-style component based on a node-style one without mangling the name - % of the shape. - % #1: node-type shape name (existing) - % #2: path-type name (to be created) - % #3: additional options to add to the path style - % - \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}% - \compattikzset{#2/.style = {\circuitikzbasekey, - /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1}, - #3}}% - \ctikzset{bipoles/#1/height/.initial=1}% -} %% %% ultra-generic bipole path %% I am not sure what the last argument is needed for, but don't touch it or everything explodes @@ -202,8 +186,75 @@ \tikztonodes } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Handling of terminals +%% Macros for path and style activation for bipoles or path-style + +\def\comnpatname{\ifpgf@circuit@compat *\else\fi} +\def\compattikzset#1{% + % \typeout{BIPOLEDEF:\space \detokenize{#1}}% + \tikzset{\comnpatname#1}} +% +% this is used for components that are mainly node-style but have a path-style form +% +\def\pgfcirc@node@to@path#1#2#3{% + % add a path-style component based on a node-style one without mangling the name + % of the shape. + % #1: node-type shape name (existing) + % #2: path-type name (to be created) + % #3: additional options to add to the path style + % + \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}% + \compattikzset{#2/.style = {\circuitikzbasekey, + /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1}, + #3}}% + \ctikzset{bipoles/#1/height/.initial=1}% +} +% +% this one is for normal definition: path to style, directly +% the first parameter (#1) here is l,v,i (l=..., v=..., i=...) +% the last parameter are options to be inserted in the "to path" definition +% +\def\pgfcirc@path@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@#2@path to style #3 + \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\csname pgf@circ@#2@path\endcsname, #1={##1}}}% +} +% this one create a alias style from a node definition +\def\pgfcirc@node@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@bipole@path{#2} to style #3 + \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\pgf@circ@bipole@path{#2}, #1={##1}}}% +} +% this create an alias style +\def\pgfcirc@style@to@style#1#2{% alias style #1 to style #2 + \compattikzset{#2/.style={\comnpatname #1={##1}}}% +} +% this create an alias style, changing the labelling +\def\pgfcirc@style@to@style@label#1#2#3{% alias style #1 to style #2 + \compattikzset{#2/.style={\comnpatname #1, #3={##1}}}% +} +% create a bipole +\def\pgfcirc@activate@bipole#1#2#3#4{% path name, base node name, style name + \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}% + \pgfcirc@path@to@style{#1}{#2}{#4}{}% no options here, let's see +} +\def\pgfcirc@activate@bipole@simple#1#2{\pgfcirc@activate@bipole{#1}{#2}{#2}{#2}} +% create a bipole with options +\def\pgfcirc@activate@bipole@opt#1#2#3#4#5{% path name, base node name, style name + \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}% + \pgfcirc@path@to@style{#1}{#2}{#4}{#5}% no options here, let's see +} +\def\pgfcirc@activate@bipole@simple@opt#1#2#3{\pgfcirc@activate@bipole@opt{#1}{#2}{#2}{#2}{#3}} + + +%% New system, for simple object +%% \pgfcirc@activate@bipole@simple{l}{mass} +%% New system, different names +%% The old system is the following +%% 1 - define just the pgf@circ@path@whatever#1 +%% (see for example the variable one) +%% 2 - set the style +%% \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l={#1}}} + +%% Path definition with the new mechanism have been moved to where the nodes +%% are defined. + +%% Handling of terminals%<<< \ctikzset{bipole/nodes/.is family} \ctikzset{bipole/nodes/left/.initial=none} @@ -252,662 +303,11 @@ \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} } \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi } +% %>>> -%% Path definitions -\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi} -\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi} -\def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi} -\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi} -\def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}} -\def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}} -\def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}} -\def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}} -\def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} -\def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}} -\def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}} -%% polar capacitor is deprectaed, use curved capacitor instead -\def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}} -\def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}} -\def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}} -\def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}} -\def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} -\def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}} -\def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}} -\def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} -\def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}} -\def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}} -\def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}} -\def\pgf@circ@inductor@path#1{% - \pgfextra{ - \edef\pgf@circ@temp{\ctikzvalof{inductor}}% - \def\pgf@temp{european}% - } - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@europeaninductor@path{#1}% - \else% - \pgfextra{ \def\pgf@temp{cute} }% - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@cuteinductor@path{#1}% - \else% - \pgf@circ@americaninductor@path{#1}% - \fi% - \fi% -} -\def\pgf@circ@vinductor@path#1{ - \pgfextra{ - \edef\pgf@circ@temp{\ctikzvalof{inductor}}% - \def\pgf@temp{european}% - } - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@veuropeaninductor@path{#1}% - \else% - \pgfextra{ \def\pgf@temp{cute} }% - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@vcuteinductor@path{#1}% - \else% - \pgf@circ@vamericaninductor@path{#1}% - \fi% - \fi% -} -\def\pgf@circ@inductivesens@path#1{% - \pgfextra{ - \edef\pgf@circ@temp{\ctikzvalof{inductor}}% - \def\pgf@temp{european}% - } - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@europeaninductivesens@path{#1}% - \else% - \pgfextra{ \def\pgf@temp{cute} }% - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@cuteinductivesens@path{#1}% - \else% - \pgf@circ@americaninductivesens@path{#1}% - \fi% - \fi% -} -\def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} -\def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}} -\def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}} -\def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}} -\def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}} -\def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}} -\def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}} -\def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}} -\def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}} -\def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}} -\def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}} -\def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}} -\def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}} -\def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}} -\def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}} -\def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}} -\def\pgf@circ@oosourcetrans@path#1{\pgf@circ@bipole@path{oosourcetrans}{#1}} -\def\pgf@circ@ooosource@path#1{\pgf@circ@bipole@path{ooosource}{#1}} -\def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}} -\def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}} -\def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}} -\def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}} -\def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} -\def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}} -\def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} -\def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} -\def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} -\def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}} -\def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}} -\def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}} -\def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}} -\def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}} -\def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}} -\def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}} -\def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}} -\def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}} -\def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}} -\def\pgf@circ@pushbuttonc@path#1{\pgf@circ@bipole@path{pushbuttonc}{#1}} -\def\pgf@circ@ncpushbuttono@path#1{\pgf@circ@bipole@path{ncpushbuttono}{#1}} -\def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}} -\def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}} -\def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}} -\def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}} -\def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}} -\def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} -\def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} -\def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}} -\def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}} -\def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}} -\def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}} -\def\pgf@circ@empty@path#1{} -\def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}} -\def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}} -\def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}} -\def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}} -\def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}} -\def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}} -\def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}} -\def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}} -\def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}} -\def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}} -\def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}} -\def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}} -\def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}} -\def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}} -\def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}} - -\def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} -\def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}} -\def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}} - -\def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}} -\def\pgf@circ@twoportsplit@path#1{\pgf@circ@bipole@path{twoportsplit}{#1}} -\def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}} -\def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}} -\def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}} -\def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}} -\def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}} -\def\pgf@circ@allpass@path#1{\pgf@circ@bipole@path{allpass}{#1}} -\def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}} -\def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}} -\def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}} -\def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}} -\def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}} -\def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}} -\def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}} -\def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}} -\def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}} -\def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}} -\def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}} -\def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}} -\def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}} -% -\def\pgf@circ@sacdc@path#1{\pgf@circ@bipole@path{sacdc}{#1}} -\def\pgf@circ@sdcac@path#1{\pgf@circ@bipole@path{sdcac}{#1}} -\def\pgf@circ@tacdc@path#1{\pgf@circ@bipole@path{tacdc}{#1}} -\def\pgf@circ@tdcac@path#1{\pgf@circ@bipole@path{tdcac}{#1}} - -%%Mechanical -\def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}} -\def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}} -\def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}} -\def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}} -\def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}} - -%% Styles - -\def\comnpatname{\ifpgf@circuit@compat *\else\fi} -\def\compattikzset#1{% - % \typeout{BIPOLEDEF:\space \detokenize{#1}}% - \tikzset{\comnpatname#1}} - -%\def\ctikzsetbipole#1#2{% -% \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}% -%} - -\compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}} -\compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}} -\compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}} -\compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}} -\compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}} -\compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}} -\compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}} -\compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}} -\compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}} -\compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}} -\compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}} -\compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}} -\compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}} -\compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} -\compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}} -\compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}} -\compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}} -\compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}} -\compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}} -\compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}} -\compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} -\compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} -% polar capacitor is deprecated, use curved capacitor instead -\compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}} -\compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}} -\compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}} -\compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}} -\compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}} -\compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} -\compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}} -\compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}} -\compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} -\compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}} -\compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}} -\compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}} -\compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}} -\compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}} -\compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}} -\compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}} -\compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}} -\compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}} -\compattikzset{transmission line/.style = {tline = #1}} -\compattikzset{TL/.style = {tline = #1}} -\compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}} -\compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} -\compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} -\compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} -\compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesquare@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} -\compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcetri@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} -\compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} - -\compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} -\compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}} -\compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} -\compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}} - - -\compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}} -\compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}} -\compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}} -\compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}} -\compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}} -\compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}} -\compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}} -\compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}} - -\compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}} -\compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}} - -\compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}} -\compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}} -\compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}} -\compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}} -\compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}} -\compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}} - -\compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}} -\compattikzset{twoportsplit/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoportsplit@path}} -\compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}} -\compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}} -\compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}} -\compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}} -\compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}} -\compattikzset{allpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@allpass@path}} -\compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}} -\compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}} -\compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}} -\compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}} -\compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}} -\compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}} -\compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}} -\compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}} -\compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}} -\compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}} -\compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}} -\compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}} -\compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}} -% -\compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sacdc@path, l=#1}} -\compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sdcac@path, l=#1}} -\compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tacdc@path, l=#1}} -\compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tdcac@path, l=#1}} - -% % % % % % -% % Begin of Diodes -% % % % % % - -\def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}} -\def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}} -\def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}} -\def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}} -\def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}} -\def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}} -\def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}} -\def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}} -\def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}} -\def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}} -\def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}} -\def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}} -\def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}} -\def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}} -\def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}} -\def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}} -\def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}} -\def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}} - -\compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}} -\compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}} -\compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}} -\compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}} -\compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}} -\compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}} -\compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}} -\compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}} -\compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}} -\compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}} -\compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}} - -\compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}} -\compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}} -\compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}} -\compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}} -\compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}} -\compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}} -\compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}} -\compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}} -\compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}} -\compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}} -\compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}} - -\compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}} -\compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}} -\compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}} -\compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}} -\compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}} -\compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}} -\compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}} -\compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}} -\compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}} -%\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}} - -\def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi} - -\compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}} -\compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}} -\compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}} -\compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}} -\compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}} -\compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}} -\compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}} -\compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}} -\compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}} -\compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac! -\compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac) - -%% Define Shortcuts -\compattikzset{Do/.style = {\comnpatname empty diode}} -\compattikzset{tDo/.style = {\comnpatname empty tunnel diode}} -\compattikzset{zDo/.style = {\comnpatname empty Zener diode}} -\compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}} -\compattikzset{sDo/.style = {\comnpatname empty Schottky diode}} -\compattikzset{pDo/.style = {\comnpatname empty photodiode}} -\compattikzset{leDo/.style = {\comnpatname empty led}} -\compattikzset{VCo/.style = {\comnpatname empty varcap}} -\compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}} -\compattikzset{Tyo/.style = {\comnpatname empty thyristor}} -\compattikzset{Tro/.style = {\comnpatname empty triac}} - -\compattikzset{D*/.style = {\comnpatname full diode}} -\compattikzset{tD*/.style = {\comnpatname full tunnel diode}} -\compattikzset{zD*/.style = {\comnpatname full Zener diode}} -\compattikzset{zzD*/.style = {\comnpatname full ZZener diode}} -\compattikzset{sD*/.style = {\comnpatname full Schottky diode}} -\compattikzset{pD*/.style = {\comnpatname full photodiode}} -\compattikzset{leD*/.style = {\comnpatname full led}} -\compattikzset{VC*/.style = {\comnpatname full varcap}} -\compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}} -\compattikzset{Ty*/.style = {\comnpatname full thyristor}} -\compattikzset{Tr*/.style = {\comnpatname full triac}} - -\compattikzset{D/.style = {\comnpatname diode}} -\compattikzset{tD/.style = {\comnpatname tunnel diode}} -\compattikzset{zD/.style = {\comnpatname Zener diode}} -\compattikzset{zzD/.style = {\comnpatname ZZener diode}} -\compattikzset{sD/.style = {\comnpatname Schottky diode}} -\compattikzset{pD/.style = {\comnpatname photodiode}} -\compattikzset{leD/.style = {\comnpatname led}} -\compattikzset{VC/.style = {\comnpatname varcap}} -\compattikzset{biD/.style = {\comnpatname bidirectionaldiode}} -\compattikzset{Ty/.style = {\comnpatname thyristor}} -\compattikzset{Tr/.style = {\comnpatname triac}} - -\compattikzset{D-/.style = {\comnpatname stroke diode}} -\compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}} -\compattikzset{zD-/.style = {\comnpatname stroke Zener diode}} -\compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}} -\compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}} -\compattikzset{pD-/.style = {\comnpatname stroke photodiode}} -\compattikzset{leD-/.style = {\comnpatname stroke led}} -\compattikzset{VC-/.style = {\comnpatname stroke varcap}} -\compattikzset{Ty-/.style = {\comnpatname stroke thyristor}} -\compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac! -\compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac) - -% % % % % % -% % End of Diodes -% % % % % % - - -\compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}} -\compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} -\compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}} -\compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} -\compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} -\compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} -\compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} -\compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} -\compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} -\compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} -\compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} -\compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} -\compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} -\compattikzset{nopbc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}} -\compattikzset{normally open push button closed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}} -\compattikzset{ncpbo/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}} -\compattikzset{normally closed push button open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}} -\compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}} - -\compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}} -\compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}} -\compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}} -\tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}} - -% cute switches -%% closed cute switch -\def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}} -\compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}} -\compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}} - -%% open cute switch -\def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}} -\compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}} -\compattikzset{cosw/.style= {\comnpatname cute open switch= #1}} - -%% closing cute switch -\def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}} -\compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}} -\compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}} - -%% opening cute switch -\def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}} -\compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}} -\compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}} - - -% short forms -\compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}} - -\compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}} -\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosource@path, v=#1}} -\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}} -\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@ooosource@path, v=#1}} - -\compattikzset{vsource/.style = {\comnpatname voltage source = #1}} -\compattikzset{isource/.style = {\comnpatname current source = #1}} -\compattikzset{cisource/.style = {\comnpatname controlled current source = #1}} -\compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}} -\compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}} -\compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}} -\compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}} -\compattikzset{vsourcetri/.style = {triangle voltage source = #1}} -\compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}} -\compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}} -\compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}} - -\compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}} -\compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}} -\compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}} -\compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}} - -\compattikzset{R/.style= {\comnpatname resistor = #1}} -\compattikzset{vR/.style= {\comnpatname variable resistor = #1}} -\compattikzset{phR/.style= {\comnpatname photoresistor = #1}} -\compattikzset{thR/.style= {\comnpatname thermistor = #1}} -\compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}} -\compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}} -\compattikzset{pR/.style= {\comnpatname potentiometer = #1}} -\compattikzset{C/.style = {\comnpatname capacitor = #1}} -\compattikzset{eC/.style = {\comnpatname ecapacitor = #1}} -%% pC is deprecated, use cC instead -\compattikzset{pC/.style = {\comnpatname polar capacitor = #1}} -\compattikzset{cC/.style = {\comnpatname curved capacitor = #1}} -\compattikzset{vC/.style = {\comnpatname variable capacitor = #1}} -\compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}} -\compattikzset{L/.style = {\comnpatname inductor = #1}} -\compattikzset{vL/.style = {\comnpatname variable inductor = #1}} -\compattikzset{V/.style = {\comnpatname voltage source = #1}} -\compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}} -\compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}} -\compattikzset{sqV/.style = {\comnpatname square voltage source = #1}} -\compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}} -\compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}} -\def\pgf@temp#1{ - \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} } - \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} } - \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} } - \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} } -} -\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} -\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} - -%current sources -\compattikzset{I/.style = {\comnpatname current source = #1}} -\compattikzset{cI/.style = {\comnpatname controlled current source = #1}} -\compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}} -\compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}} -\def\pgf@temp#1{ - \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} } - \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} } - \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} } - \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} } -} -\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} -\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} -\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} - -% cute sources -\def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}} -\compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}} -\compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}} - -\def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}} -\compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}} -\compattikzset{ceI/.style= {\comnpatname cute european current source= #1}} - -\def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}} -\compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}} -\compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}} - -\def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}} -\compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}} -\compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}} - -% noise sources -\def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}} -\compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceN@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}} -\compattikzset{nV/.style= {\comnpatname noise voltage source= #1}} - -\def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}} -\compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{isourceN/.style= {\comnpatname noise current source= #1}} -\compattikzset{nI/.style= {\comnpatname noise current source= #1}} - -% resistive sensor american style -\def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}} -\compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}} -\compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} -\compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}} -\compattikzset{sR/.style= {\comnpatname resistive sensor= #1}} - -\compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}} -\compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}} - -\compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}} -\compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}} -\compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}} -\compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}} -\compattikzset{sL/.style= {\comnpatname inductive sensor= #1}} - -\compattikzset{Mr/.style = {\comnpatname memristor}} - -\compattikzset{cspst/.style = {\comnpatname closing switch = #1}} -\compattikzset{ospst/.style = {\comnpatname opening switch = #1}} -\compattikzset{spst/.style = {\comnpatname switch = #1}} - -\compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}} - -\compattikzset{vdd/.style = {\comnpatname vcc = #1}} -\compattikzset{vss/.style = {\comnpatname vee = #1}} - -% activate the to-style crossing -\def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}} -\compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}} -\compattikzset{xing/.style= {\comnpatname crossing= #1}} - -%% loudspeaker and microphone - -\def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}} -\compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}} - -\def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}} -\compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}} - -% more instrument -\def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}} -\compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}} -\def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}} -\compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}} -\def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}} -\compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}} -% current loop probes -\def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}} -\compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}} -\def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}} -\compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}} -% qucs-style probes -\def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}} -\compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}} -\def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}} -\compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}} -\def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}} -\compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}} -% multiwire(s) -\def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}} -\compattikzset{bmultiwire/.style = {\circuitikzbasekey, -/tikz/to path=\pgf@circ@bmultiwire@path, l=#1}} -\def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}} -\compattikzset{multiwire/.style = {\circuitikzbasekey, -/tikz/to path=\pgf@circ@multiwire@path, l=#1}} -\def\pgf@circ@tmultiwire@path#1{\pgf@circ@bipole@path{tmultiwire}{#1}} -\compattikzset{tmultiwire/.style = {\circuitikzbasekey, -/tikz/to path=\pgf@circ@tmultiwire@path, l=#1}} - -% reed switches -\def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}} -\compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}} - +%% +%% Definition of path for transistors +%% % Transistor like bipoles \def\pgf@circ@trans@path#1#2{ @@ -948,53 +348,12 @@ \pgfextra{ \pgfcircresetpath } - (\tikztotarget) \tikztonodes % e si continua + (\tikztotarget) \tikztonodes % and go on! } - \def\pgf@circ@definetranspath#1{ \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}} } -\pgf@circ@definetranspath{elmech} -\pgf@circ@definetranspath{nmos} -\pgf@circ@definetranspath{pmos} -\pgf@circ@definetranspath{nmosd} -\pgf@circ@definetranspath{pmosd} -\pgf@circ@definetranspath{hemt} -\pgf@circ@definetranspath{npn} -\pgf@circ@definetranspath{pnp} -\pgf@circ@definetranspath{nfet} -\pgf@circ@definetranspath{nigfete} -\pgf@circ@definetranspath{nigfetd} -\pgf@circ@definetranspath{nigfetebulk} -\pgf@circ@definetranspath{pfet} -\pgf@circ@definetranspath{pigfete} -\pgf@circ@definetranspath{pigfetd} -\pgf@circ@definetranspath{pigfetebulk} -\pgf@circ@definetranspath{njfet} -\pgf@circ@definetranspath{pjfet} -\pgf@circ@definetranspath{pigbt} -\pgf@circ@definetranspath{nigbt} -\pgf@circ@definetranspath{Lpigbt} -\pgf@circ@definetranspath{Lnigbt} -% -% Path-style logical ports % -% create path-style element for one input --- one output logical ports -% -\def\pgfcirc@port@node@to@path#1#2{% - % - % add a logic port path style component --- we need to suppress leads - % and use the correct center - % - \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}% -} -\pgfcirc@port@node@to@path{not port}{inline not} -\pgfcirc@port@node@to@path{buffer port}{inline buffer} -\pgfcirc@port@node@to@path{schmitt port}{inline schmitt} -\pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt} - -\pgfcirc@port@node@to@path{tgate}{inline tgate} -\pgfcirc@port@node@to@path{double tgate}{inline double tgate} - +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex index 469f7aa8e49..e00b33ad591 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -12,6 +12,54 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Quadripoles +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% Setting for Transformers and similar quadpoles%<<<1 + +\ctikzset{quadpoles/transformer/inner/.initial=0.4} +\ctikzset{quadpoles/transformer/width/.initial=1.5} +\ctikzset{quadpoles/transformer/width1/.initial=.4} +\ctikzset{quadpoles/transformer/height/.initial=1.5} +\ctikzset{quadpoles/transformer/height1/.initial=.8} +\ctikzset{quadpoles/transformer core/inner/.initial=0.4} +\ctikzset{quadpoles/transformer core/width/.initial=1.5} +\ctikzset{quadpoles/transformer core/height/.initial=1.5} +\ctikzset{quadpoles/transformer core/core height/.initial=.5} +\ctikzset{quadpoles/transformer core/core width/.initial=.05} +\ctikzset{quadpoles/gyrator/inner/.initial=0.4} +\ctikzset{quadpoles/gyrator/width/.initial=1.5} +\ctikzset{quadpoles/gyrator/height/.initial=1.5} +\ctikzset{quadpoles/fourport/width/.initial=1.3} +\ctikzset{quadpoles/fourport/height/.initial=1.3} +\ctikzset{quadpoles/coupler/width/.initial=1.3} +\ctikzset{quadpoles/coupler/height/.initial=1.3} +\ctikzset{quadpoles/coupler2/width/.initial=1.3} +\ctikzset{quadpoles/coupler2/height/.initial=1.3} + + +\ctikzset{quadpoles style/.is choice} +\ctikzset{quadpoles style/inward/.code={% default value + \ctikzset{quadpoles/transformer/inner=0.4}% + \ctikzset{quadpoles/transformer/width=1.5}% + \ctikzset{quadpoles/transformer core/inner=0.4}% + \ctikzset{quadpoles/transformer core/width=1.5}% + \ctikzset{quadpoles/gyrator/inner=0.4}% + \ctikzset{quadpoles/gyrator/width=1.5}% + }% +} +\ctikzset{quadpoles style/inline/.code={% now horizontal baffle + \ctikzset{quadpoles/transformer/inner=1}% + \ctikzset{quadpoles/transformer/width=0.6}% + \ctikzset{quadpoles/transformer core/inner=1}% + \ctikzset{quadpoles/transformer core/width=0.6}% + \ctikzset{quadpoles/gyrator/inner=1} % FIXME + \ctikzset{quadpoles/gyrator/width=0.6}% + }% +} +%%>>> + +%% Node shapes for quadpoles (basically transformers)%<<< \long\def\pgfcircdeclarequadpole#1#2#3{ \pgfdeclareshape{#1} @@ -339,10 +387,1762 @@ \pgfpathclose \pgf@circ@draworfill }{} +% %>>> + +%%%%%%%%%%%%%%%%%%% +%% Block diagrams +%%%%%%%%%%%%%%%%%%% + +% Definitions and options for blocks (twoports and so)%<<<1 + +\ctikzset{bipoles/twoport/width/.initial=.7} +\ctikzset{bipoles/twoport/height/.initial=.7} +\ctikzset{bipoles/twoport/text/.initial=} +\ctikzset{bipoles/twoportsplit/width/.initial=.7} +\ctikzset{bipoles/twoport/text in/.initial=} +\ctikzset{bipoles/twoport/text out/.initial=} +\ctikzset{text/.style={t=#1}} +\ctikzset{t/.code={% + \ctikzsetvalof{bipoles/twoport/text}{#1}% +}} +\ctikzset{text in/.style={t1=#1}} +\ctikzset{t1/.code={% + \ctikzsetvalof{bipoles/twoport/text in}{#1}% +}} +\ctikzset{text out/.style={t2=#1}} +\ctikzset{t2/.code={% + \ctikzsetvalof{bipoles/twoport/text out}{#1}% +}} +\ctikzset{bipoles/vco/width/.initial=.7} +\ctikzset{bipoles/bandpass/width/.initial=.7} +\ctikzset{bipoles/bandstop/width/.initial=.7} +\ctikzset{bipoles/highpass/width/.initial=.7} +\ctikzset{bipoles/lowpass/width/.initial=.7} +\ctikzset{bipoles/allpass/width/.initial=.7} +\ctikzset{bipoles/adc/width/.initial=.7} +\ctikzset{bipoles/dac/width/.initial=.7} +\ctikzset{bipoles/dsp/width/.initial=.7} +\ctikzset{bipoles/fft/width/.initial=.7} +\ctikzset{bipoles/amp/width/.initial=.7} +\ctikzset{bipoles/vamp/width/.initial=.7} +\ctikzset{bipoles/piattenuator/width/.initial=.7} +\ctikzset{bipoles/vpiattenuator/width/.initial=.7} +\ctikzset{bipoles/tattenuator/width/.initial=.7} +\ctikzset{bipoles/vtattenuator/width/.initial=.7} +\ctikzset{bipoles/phaseshifter/width/.initial=.7} +\ctikzset{bipoles/vphaseshifter/width/.initial=.7} +\ctikzset{bipoles/detector/width/.initial=.7} +\ctikzset{tripoles/mixer/width/.initial=0.7} +\ctikzset{tripoles/adder/width/.initial=0.7} +\ctikzset{tripoles/circulator/width/.initial=.7} +\ctikzset{tripoles/oscillator/width/.initial=.7} + +\ctikzset{tripoles/wilkinson/height/.initial=1.3} +\ctikzset{tripoles/wilkinson/width/.initial=1.3} + +\ctikzset{tripoles/splitter/height/.initial=1.3} +\ctikzset{tripoles/splitter/width/.initial=1.3} + +\ctikzset{tripoles/mzm/height/.initial=1.3} +\ctikzset{tripoles/mzm/width/.initial=1.3} + +% Option ">" for twoports +\newif\ifpgf@circuit@inputarrow +\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/.is choice} +\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} + +% Option "boxed" for nodes and twoports +\newif\ifpgf@circuit@boxed +\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} +\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} + +% Option "dashed" for nodes and twoports +\newif\ifpgf@circuit@dashed +\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} +\ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}% + +% powerelectronic blocks +\ctikzset{bipoles/sacdc/width/.initial=.7} +\ctikzset{bipoles/sdcac/width/.initial=.7} +\ctikzset{bipoles/tacdc/width/.initial=.7} +\ctikzset{bipoles/tdcac/width/.initial=.7} +\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? + +%>>> + +%% Node shapes definition for path-style block diagrams%<<< + +%% Draw the two-port fillable box +\def\pgf@circ@twoportbox{ + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope +} + +%% Generic two port box +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/twoport/height}} +{twoport} +{\ctikzvalof{bipoles/twoport/height}} +{\ctikzvalof{bipoles/twoport/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + +} + +%% twoport split +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/twoportsplit/width}} +{twoportsplit} +{\ctikzvalof{bipoles/twoportsplit/width}} +{\ctikzvalof{bipoles/twoportsplit/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + %get texts + \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}} + \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}} + + % rotate inner symbol + \def\texti{\pgfcirc@tin} + \def\textii{\pgfcirc@tout} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{\pgfcirc@tout} + \def\textii{\pgfcirc@tin} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{\pgfcirc@tout} + \def\textii{\pgfcirc@tin} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{\pgfcirc@tin} + \def\textii{\pgfcirc@tout} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii} +} + +%% voltage controled oscillator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vco/width}} +{vco} +{\ctikzvalof{bipoles/twoport/width}} +{\ctikzvalof{bipoles/vco/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} + \pgf@circ@draworfill + \endpgfscope + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner sine waves + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/bandpass/width}} +{bandpass} +{\ctikzvalof{bipoles/bandpass/width}} +{\ctikzvalof{bipoles/bandpass/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandstop filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/bandstop/width}} +{bandstop} +{\ctikzvalof{bipoles/bandstop/width}} +{\ctikzvalof{bipoles/bandstop/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt}% always draw solid line for inner symbol + \pgfsetarrows{-}%never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% highpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/highpass/width}} +{highpass} +{\ctikzvalof{bipoles/highpass/width}} +{\ctikzvalof{bipoles/highpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% lowpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/lowpass/width}} +{lowpass} +{\ctikzvalof{bipoles/lowpass/width}} +{\ctikzvalof{bipoles/lowpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% allpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/allpass/width}} +{allpass} +{\ctikzvalof{bipoles/allpass/width}} +{\ctikzvalof{bipoles/allpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% ADC +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/adc/width}} +{adc} +{\ctikzvalof{bipoles/adc/width}} +{\ctikzvalof{bipoles/adc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{A} + \def\textii{D} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{D} + \def\textii{A} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{D} + \def\textii{A} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{A} + \def\textii{D} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DAC +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/dac/width}} +{dac} +{\ctikzvalof{bipoles/dac/width}} +{\ctikzvalof{bipoles/dac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{D} + \def\textii{A} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{A} + \def\textii{D} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{A} + \def\textii{D} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{D} + \def\textii{A} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DSP +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/dsp/width}} +{dsp} +{\ctikzvalof{bipoles/dsp/width}} +{\ctikzvalof{bipoles/dsp/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{DSP}} +} + +%% FFT +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/fft/width}} +{fft} +{\ctikzvalof{bipoles/fft/width}} +{\ctikzvalof{bipoles/fft/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{FFT}} +} + +%% Amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{amp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgf@circ@draworfill + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} +} + + +%% variable amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{vamp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + + % draw arrow + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% pi attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/piattenuator/width}} +{piattenuator} +{\ctikzvalof{bipoles/piattenuator/width}} +{\ctikzvalof{bipoles/piattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable pi attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{vpiattenuator} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% T attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/tattenuator/width}} +{tattenuator} +{\ctikzvalof{bipoles/tattenuator/width}} +{\ctikzvalof{bipoles/tattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable T attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vtattenuator/width}} +{vtattenuator} +{\ctikzvalof{bipoles/vtattenuator/width}} +{\ctikzvalof{bipoles/vtattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% phase shifter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{phaseshifter} +{\ctikzvalof{bipoles/phaseshifter/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} +} + +%% variable phase shifter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{vphaseshifter} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% detector +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/detector/width}} +{detector} +{\ctikzvalof{bipoles/detector/width}} +{\ctikzvalof{bipoles/detector/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{0.8\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \ifpgf@circuit@fulldiode + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} + \else + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} + \fi + +} + +%% single phase ac/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + } +} +{\ctikzvalof{bipoles/sacdc/width}} +{sacdc} +{\ctikzvalof{bipoles/sacdc/width}} +{\ctikzvalof{bipoles/sacdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 -%%%%%%%%%%%%%%%%%%%% -%% Block elements -%%%%%%%%%%%%%%%%%%%% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin wave + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + + +%% single phase dc/ac converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + \pgf@x=-\pgf@x + } +} +{\ctikzvalof{bipoles/sdcac/width}} +{sdcac} +{\ctikzvalof{bipoles/sdcac/width}} +{\ctikzvalof{bipoles/sdcac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin wave + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +%% threephase ac/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + } + \anchor{ac1}{ + \northeast + \pgf@y=.6\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac2}{ + \northeast + \pgf@y=0\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac3}{ + \northeast + \pgf@y=-.6\pgf@y + \pgf@x=-\pgf@x + } +} +{\ctikzvalof{bipoles/tacdc/width}} +{tacdc} +{\ctikzvalof{bipoles/tacdc/width}} +{\ctikzvalof{bipoles/tacdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin waves + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + + + + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +%% threephase dc/ac converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac1}{ + \northeast + \pgf@y=.6\pgf@y + } + \anchor{ac2}{ + \northeast + \pgf@y=0\pgf@y + } + \anchor{ac3}{ + \northeast + \pgf@y=-.6\pgf@y + } +} +{\ctikzvalof{bipoles/tdcac/width}} +{tdcac} +{\ctikzvalof{bipoles/tdcac/width}} +{\ctikzvalof{bipoles/tdcac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin waves + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + + + + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} +% %>>> + +%% Path definitions for Blocks%<<< + +\pgfcirc@activate@bipole@simple{l}{twoport} +\pgfcirc@activate@bipole@simple{l}{twoportsplit} +\pgfcirc@activate@bipole@simple{l}{vco} +\pgfcirc@activate@bipole@simple{l}{bandpass} +\pgfcirc@activate@bipole@simple{l}{bandstop} +\pgfcirc@activate@bipole@simple{l}{highpass} +\pgfcirc@activate@bipole@simple{l}{lowpass} +\pgfcirc@activate@bipole@simple{l}{allpass} +\pgfcirc@activate@bipole@simple{l}{adc} +\pgfcirc@activate@bipole@simple{l}{dac} +\pgfcirc@activate@bipole@simple{l}{dsp} +\pgfcirc@activate@bipole@simple{l}{fft} +\pgfcirc@activate@bipole@simple{l}{amp} +\pgfcirc@activate@bipole@simple{l}{vamp} +\pgfcirc@activate@bipole@simple{l}{piattenuator} +\pgfcirc@activate@bipole@simple{l}{vpiattenuator} +\pgfcirc@activate@bipole@simple{l}{tattenuator} +\pgfcirc@activate@bipole@simple{l}{vtattenuator} +\pgfcirc@activate@bipole@simple{l}{phaseshifter} +\pgfcirc@activate@bipole@simple{l}{vphaseshifter} +\pgfcirc@activate@bipole@simple{l}{detector} +\pgfcirc@activate@bipole@simple{l}{sacdc} +\pgfcirc@activate@bipole@simple{l}{sdcac} +\pgfcirc@activate@bipole@simple{l}{tacdc} +\pgfcirc@activate@bipole@simple{l}{tdcac} +% %>>> + +%% Node shapes for Block elements%<<< \pgfdeclareshape{mixer} { @@ -1054,25 +2854,25 @@ \anchor{west}{ \northwest \pgf@y=0pt - } + } \anchor{left}{ \northwest \pgf@y=0pt } - \anchor{south west}{ - \northwest + \anchor{south west}{ + \northwest \pgf@y=-\pgf@y } \anchor{north east}{ - \northwest + \northwest \pgf@x=-\pgf@x \relax } - \anchor{north west}{ - \northwest + \anchor{north west}{ + \northwest } - \anchor{south east}{ - \northwest + \anchor{south east}{ + \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } @@ -1086,13 +2886,13 @@ \pgf@circ@scaled@Rlen=\scaledRlen \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen - + \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - + \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 @@ -1106,8 +2906,8 @@ % draw outer box \pgf@circ@twoportbox - - + + \ifpgf@circuit@inputarrow { \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth @@ -1115,34 +2915,34 @@ \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } \fi - + \pgfsetdash{}{0pt} % always draw solid line for inner symbol \pgfsetarrows{-} %never draw arrows \pgfsetlinewidth{0.05mm} - + % draw grid \foreach \line in {-1,-.5,...,1} { \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}} - + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}} } - + %prevent from draw the inner cross twice \foreach \line in {-.5,0,...,.5} { \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}} - + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}} } \pgfusepath{draw} } } - + % Wilkinson divider \pgfdeclareshape{wilkinson}{ @@ -1733,7 +3533,7 @@ \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}} \pgfusepath{draw} - + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}} @@ -1741,3 +3541,6 @@ } } +% %>>> + +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex index 45497d7e614..cea4b719224 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index 8fb072ae71e..f6ebcf61a34 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -12,268 +12,262 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Tripoles +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%% -%% switches -%%%%%%%%%%%%% - -% Legacy spdt -\pgfdeclareshape{spdt}{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedanchor\northwest{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - } - \anchor{left}{% - \northwest - \pgf@y=0pt - } - \anchor{in}{ - \northwest - \pgf@y=0pt - } - \anchor{out 1}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{out 2}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{north}{ - \northwest - \pgf@x=0pt - } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y - } - \anchor{north east}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{north west}{ - \northwest - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \backgroundpath{ - \pgfsetcolor{\ctikzvalof{color}} - - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left - - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - - \pgfusepath{draw} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Logic Ports +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \pgfscope - \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} - \endpgfscope - \pgfscope - \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} - \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}} - \endpgfscope - \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} - \endpgfscope +%% Settings for Logic ports%<<<1 +%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex - \pgfscope - \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} - \pgfpathlineto{ - \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} - {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} - } - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfusepath{draw} - \endpgfscope - } +% switches for logic gates +% +\pgfkeys{/tikz/number inputs/.initial=0} +\pgfkeys{/tikz/number inputs/.default=0} + +\newif\ifpgf@circuit@europeanlogicport +\ctikzset{logic ports/.is choice} +\ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue + \tikzset{and port/.style={shape=european and port}}% + \tikzset{or port/.style={shape=european or port}}% + \tikzset{xor port/.style={shape=european xor port}}% + \tikzset{buffer port/.style={shape=european buffer port}}% + \tikzset{not port/.style={shape=european not port}}% + \tikzset{nand port/.style={shape=european nand port}}% + \tikzset{nor port/.style={shape=european nor port}}% + \tikzset{xnor port/.style={shape=european xnor port}}% + % there is no Schmitt ports in european style (yet) + \tikzset{schmitt port/.style={shape=schmitt}}% + \tikzset{invschmitt port/.style={shape=invschmitt}}% +}} +\ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse + \tikzset{and port/.style={shape=american and port}}% + \tikzset{or port/.style={shape=american or port}}% + \tikzset{xor port/.style={shape=american xor port}}% + \tikzset{buffer port/.style={shape=american buffer port}}% + \tikzset{not port/.style={shape=american not port}}% + \tikzset{nand port/.style={shape=american nand port}}% + \tikzset{nor port/.style={shape=american nor port}}% + \tikzset{xnor port/.style={shape=american xnor port}}% + \tikzset{schmitt port/.style={shape=schmitt}}% + \tikzset{invschmitt port/.style={shape=invschmitt}}% +}} + +\ctikzset{logic ports origin/.is choice} +\ctikzset{logic ports origin/legacy/.code={ + \ctikzset{tripoles/american and port/origin/.initial=0.8}% + \ctikzset{tripoles/american nand port/origin/.initial=0.8}% + \ctikzset{tripoles/american nor port/origin/.initial=0.8}% + \ctikzset{tripoles/american or port/origin/.initial=0.8}% + \ctikzset{tripoles/american xor port/origin/.initial=0.8}% + \ctikzset{tripoles/american xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european and port/origin/.initial=0.8}% + \ctikzset{tripoles/european nand port/origin/.initial=0.8}% + \ctikzset{tripoles/european or port/origin/.initial=0.8}% + \ctikzset{tripoles/european nor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european buffer port/origin/.initial=0.8}% + \ctikzset{tripoles/european not port/origin/.initial=0.8}% + }% } - - -% cute switch "node" shapes, matching with cute "to" shapes -% #1 -> name -% #2 -> barposition -% #3 -> arrowcode -\long\def\pgfcircdeclarecutespdt#1#2#3{ - \pgfdeclareshape{#1} - { - \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedanchor\northwest{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen - \pgf@x=.25\pgf@x - } - \savedanchor\midlever{ - % these values are calculated when we create the definition of the shape. - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen - \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen - \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp - \pgf@circ@res@down = -.5\pgf@y - \pgf@circ@res@up = .5\pgf@y - \pgfextracty{\pgf@circ@res@other}{#2} - \pgf@x=0pt - \pgf@y=.5\pgf@circ@res@other - } - % radius of the connector - % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) - \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} - % shapename - \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} - % shape type - \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}} - % mid of the lever, to stack switches - \anchor{mid}{\midlever} - % center anchors - \anchor{cin}{ \northwest \pgf@y=0pt} - \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x } - \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - % horizontal angles - \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius} - \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius} - \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y } - - \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } - \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{west}{ \northwest \pgf@y=0pt } - \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } - \anchor{north}{ \northwest \pgf@x=0pt } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - - \backgroundpath{ - \pgfsetcolor{\ctikzvalof{color}} - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - - \pgfscope - % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) - \pgf@circ@res@temp=\radius\relax - \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp - \pgfsetlinewidth{2\pgf@circ@res@temp} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{#2} - \pgfsetroundcap\pgfusepath{draw} - \endpgfscope - \pgfscope % arrow - #3 - \endpgfscope - % terminals - \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}} - \endpgfscope - \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}} - \endpgfscope - \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} - \endpgfscope - - } - } +\ctikzset{logic ports origin/center/.code={% + \ctikzset{tripoles/american and port/origin/.initial=0}% + \ctikzset{tripoles/american nand port/origin/.initial=0}% + \ctikzset{tripoles/american nor port/origin/.initial=0}% + \ctikzset{tripoles/american or port/origin/.initial=0}% + \ctikzset{tripoles/american xor port/origin/.initial=0}% + \ctikzset{tripoles/american xnor port/origin/.initial=0}% + \ctikzset{tripoles/european and port/origin/.initial=0}% + \ctikzset{tripoles/european nand port/origin/.initial=0}% + \ctikzset{tripoles/european or port/origin/.initial=0}% + \ctikzset{tripoles/european nor port/origin/.initial=0}% + \ctikzset{tripoles/european xor port/origin/.initial=0}% + \ctikzset{tripoles/european xnor port/origin/.initial=0}% + \ctikzset{tripoles/european buffer port/origin/.initial=0}% + \ctikzset{tripoles/european not port/origin/.initial=0}% + }% } -\pgfcircdeclarecutespdt{cute spdt up} -{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} -{} - -\pgfcircdeclarecutespdt{cute spdt mid} -{\pgfpoint{\pgf@circ@res@right}{0pt}} -{} - -\pgfcircdeclarecutespdt{cute spdt down} -{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} -{} - -\pgfcircdeclarecutespdt{cute spdt up arrow} -{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node - \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} - \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} - \pgfusepath{draw} +\newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse +\ctikzset{american or shape/.is choice} +\ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}} +\ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}} + +\newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue +\ctikzset{logic ports draw input leads/.is choice} +\ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}} +\ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}} +\tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}} +\tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}} + +\newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue +\ctikzset{logic ports draw output leads/.is choice} +\ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}} +\ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}} +\tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}} +\tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}} + +\ctikzset{logic ports draw leads/.is choice} +\ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} +\ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} +\tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} +\tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} + +% adding a different style of xnor port +% see https://github.com/circuitikz/circuitikz/issues/467 +\ctikzset{european xnor style/.is choice} +\ctikzset{european xnor style/default/.code={% + \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}% } - -\pgfcircdeclarecutespdt{cute spdt mid arrow} -{\pgfpoint{\pgf@circ@res@right}{0pt}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node - \pgfsetarrowsstart{latexslim} - \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} - \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} - \pgfusepath{draw} +\ctikzset{european xnor style/direct/.code={% + \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}% } -\pgfcircdeclarecutespdt{cute spdt down arrow} -{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node - \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} - \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} - \pgfusepath{draw} -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% Logic ports +% old, legacy keys that should be killed over +\ctikzset{bipoles/buffer/height/.initial=1} +\ctikzset{bipoles/buffer/width/.initial=1} +\ctikzset{bipoles/not port/width/.initial=1} +\ctikzset{bipoles/not port/height/.initial=.8} +\ctikzset{bipoles/not port/circle width/.initial=.15} + +\ctikzset{tripoles/american and port/width/.initial=1.1} +\ctikzset{tripoles/american and port/height/.initial=.8} +\ctikzset{tripoles/american and port/port width/.initial=.7} +\ctikzset{tripoles/american and port/input height/.initial=.5} +\ctikzset{tripoles/american nand port/width/.initial=1.1} +\ctikzset{tripoles/american nand port/height/.initial=.8} +\ctikzset{tripoles/american nand port/port width/.initial=.7} +\ctikzset{tripoles/american nand port/circle width/.initial=.15} +\ctikzset{tripoles/american nand port/input height/.initial=.5} +\ctikzset{tripoles/american or port/width/.initial=1.1} +\ctikzset{tripoles/american or port/height/.initial=.8} +\ctikzset{tripoles/american or port/port width/.initial=.7} +\ctikzset{tripoles/american or port/input height/.initial=.5} +\ctikzset{tripoles/american or port/input skip/.initial=.25} +\ctikzset{tripoles/american or port/aaa/.initial=.6} +\ctikzset{tripoles/american or port/bbb/.initial=.4} +\ctikzset{tripoles/american or port/ccc/.initial=.5} +\ctikzset{tripoles/american or port/ddd/.initial=.0} +\ctikzset{tripoles/american nor port/width/.initial=1.1} +\ctikzset{tripoles/american nor port/height/.initial=.8} +\ctikzset{tripoles/american nor port/port width/.initial=.7} +\ctikzset{tripoles/american nor port/input height/.initial=.5} +\ctikzset{tripoles/american nor port/input skip/.initial=.25} +\ctikzset{tripoles/american nor port/circle width/.initial=.15} +\ctikzset{tripoles/american nor port/aaa/.initial=.6} +\ctikzset{tripoles/american nor port/bbb/.initial=.4} +\ctikzset{tripoles/american nor port/ccc/.initial=.5} +\ctikzset{tripoles/american nor port/ddd/.initial=.0} +\ctikzset{tripoles/american xor port/width/.initial=1.1} +\ctikzset{tripoles/american xor port/height/.initial=.8} +\ctikzset{tripoles/american xor port/port width/.initial=.7} +\ctikzset{tripoles/american xor port/input height/.initial=.5} +\ctikzset{tripoles/american xor port/input skip/.initial=.15} +\ctikzset{tripoles/american xor port/distance/.initial=.1} +\ctikzset{tripoles/american xnor port/width/.initial=1.1} +\ctikzset{tripoles/american xnor port/height/.initial=.8} +\ctikzset{tripoles/american xnor port/port width/.initial=.7} +\ctikzset{tripoles/american xnor port/input height/.initial=.5} +\ctikzset{tripoles/american xnor port/input skip/.initial=.15} +\ctikzset{tripoles/american xnor port/distance/.initial=.1} +\ctikzset{tripoles/american xnor port/circle width/.initial=.15} +\ctikzset{tripoles/american and port/origin/.initial=0.8} +\ctikzset{tripoles/american and port/inputs/.initial=2} +% variable number of inputs +\ctikzset{tripoles/american nand port/origin/.initial=0.8} +\ctikzset{tripoles/american nand port/inputs/.initial=2} +\ctikzset{tripoles/american nor port/origin/.initial=0.8} +\ctikzset{tripoles/american nor port/inputs/.initial=2} +\ctikzset{tripoles/american nor port/angle/.initial=70} +\ctikzset{tripoles/american nor port/inner/.initial=0.3} +\ctikzset{tripoles/american or port/origin/.initial=0.8} +\ctikzset{tripoles/american or port/inputs/.initial=2} +\ctikzset{tripoles/american or port/angle/.initial=70} +\ctikzset{tripoles/american or port/inner/.initial=0.3} +\ctikzset{tripoles/american xor port/origin/.initial=0.8} +\ctikzset{tripoles/american xor port/inputs/.initial=2} +\ctikzset{tripoles/american xor port/angle/.initial=70} +\ctikzset{tripoles/american xor port/inner/.initial=0.3} +\ctikzset{tripoles/american xnor port/origin/.initial=0.8} +\ctikzset{tripoles/american xnor port/inputs/.initial=2} +\ctikzset{tripoles/american xnor port/angle/.initial=70} +\ctikzset{tripoles/american xnor port/inner/.initial=0.3} + +\ctikzset{tripoles/european and port/width/.initial=1.4} +\ctikzset{tripoles/european and port/height/.initial=.65} +\ctikzset{tripoles/european and port/reserved/.initial=.6} +\ctikzset{tripoles/european and port/input height/.initial=.6} +\ctikzset{tripoles/european or port/width/.initial=1.4} +\ctikzset{tripoles/european or port/height/.initial=.65} +\ctikzset{tripoles/european or port/reserved/.initial=.6} +\ctikzset{tripoles/european or port/input height/.initial=.6} +\ctikzset{tripoles/european xor port/width/.initial=1.4} +\ctikzset{tripoles/european xor port/height/.initial=.65} +\ctikzset{tripoles/european xor port/reserved/.initial=.6} +\ctikzset{tripoles/european xor port/input height/.initial=.6} +\ctikzset{tripoles/european nand port/width/.initial=1.4} +\ctikzset{tripoles/european nand port/not height/.initial=.3} +\ctikzset{tripoles/european nand port/not width/.initial=.8} +\ctikzset{tripoles/european nand port/height/.initial=.65} +\ctikzset{tripoles/european nand port/reserved/.initial=.6} +\ctikzset{tripoles/european nand port/input height/.initial=.6} +\ctikzset{tripoles/european buffer port/width/.initial=1.4} +\ctikzset{tripoles/european buffer port/not height/.initial=.3} +\ctikzset{tripoles/european buffer port/not width/.initial=.8} +\ctikzset{tripoles/european buffer port/height/.initial=.65} +\ctikzset{tripoles/european buffer port/reserved/.initial=.6} +\ctikzset{tripoles/european buffer port/input height/.initial=0} +\ctikzset{tripoles/european not port/width/.initial=1.4} +\ctikzset{tripoles/european not port/not height/.initial=.3} +\ctikzset{tripoles/european not port/not width/.initial=.8} +\ctikzset{tripoles/european not port/height/.initial=.65} +\ctikzset{tripoles/european not port/reserved/.initial=.6} +\ctikzset{tripoles/european not port/input height/.initial=0} +\ctikzset{tripoles/european xnor port/width/.initial=1.4} +\ctikzset{tripoles/european xnor port/not height/.initial=.3} +\ctikzset{tripoles/european xnor port/not width/.initial=.8} +\ctikzset{tripoles/european xnor port/height/.initial=.65} +\ctikzset{tripoles/european xnor port/reserved/.initial=.6} +\ctikzset{tripoles/european xnor port/input height/.initial=.6} +\ctikzset{tripoles/european nor port/width/.initial=1.4} +\ctikzset{tripoles/european nor port/not height/.initial=.3} +\ctikzset{tripoles/european nor port/not width/.initial=.8} +\ctikzset{tripoles/european nor port/height/.initial=.65} +\ctikzset{tripoles/european nor port/reserved/.initial=.6} +\ctikzset{tripoles/european nor port/input height/.initial=.6} +% variable number of inputs +\ctikzset{tripoles/european and port/origin/.initial=0.8} +\ctikzset{tripoles/european and port/inputs/.initial=2} +\ctikzset{tripoles/european nand port/origin/.initial=0.8} +\ctikzset{tripoles/european nand port/inputs/.initial=2} +\ctikzset{tripoles/european or port/origin/.initial=0.8} +\ctikzset{tripoles/european or port/inputs/.initial=2} +\ctikzset{tripoles/european nor port/origin/.initial=0.8} +\ctikzset{tripoles/european nor port/inputs/.initial=2} +\ctikzset{tripoles/european xor port/origin/.initial=0.8} +\ctikzset{tripoles/european xor port/inputs/.initial=2} +\ctikzset{tripoles/european xnor port/origin/.initial=0.8} +\ctikzset{tripoles/european xnor port/inputs/.initial=2} +\ctikzset{tripoles/european buffer port/origin/.initial=0.8} +\ctikzset{tripoles/european buffer port/inputs/.initial=1}% +\ctikzset{tripoles/european not port/origin/.initial=0.8} +\ctikzset{tripoles/european not port/inputs/.initial=1}% +%%% parameters that are not used anymore after multi-input +%%% gates --- left for compatibility of source code. +\ctikzset{tripoles/american xor port/aaa/.initial=.6} +\ctikzset{tripoles/american xor port/bbb/.initial=.4} +\ctikzset{tripoles/american xor port/ccc/.initial=.5} +\ctikzset{tripoles/american xor port/ddd/.initial=.0} +\ctikzset{tripoles/american xnor port/aaa/.initial=.6} +\ctikzset{tripoles/american xnor port/bbb/.initial=.4} +\ctikzset{tripoles/american xnor port/ccc/.initial=.5} +\ctikzset{tripoles/american xnor port/ddd/.initial=.0} +%%>>> + +%% Node shapes for Logic ports%<<< %% %% Code from John Kormylo at tex.stackexchange.com %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz @@ -1566,11 +1560,1723 @@ \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} %% end european logic ports +% %>>> + +%% IEEE standard logic ports module%<<< + +%% +%% Original multi-input code from John Kormylo at tex.stackexchange.com +%% Help by TheTeXnician <38565529+TheTeXnician@users.noreply.github.com> +%% Suggested idea and example code by Jason Sachs <jmsachs@gmail.com> +%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details +%% Most of the code, all errors and bugs by Romano Giannetti <romano.giannetti@gmail.com> +%% Everything is in the same place here --- more or less; first step to move towards +%% a module interface for circutikz +%% + +% base settings for ieeestd ports. + +\ctikzset{ieeestd ports/.is family} +% baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so. +% the value of 0.4 is the standard pin distance for a port with height=num pins +% and matches the chip distance +\ctikzset{ieeestd ports/baselen/.initial=0.4} +% these are in term of baselen; width depends on height (fixed proportions) +\ctikzset{ieeestd ports/height/.initial=2} +\ctikzset{ieeestd ports/pin length/.initial=0.7} +% the standard "not" circle should be 1/6.5 of height (diameter); +% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole +\ctikzset{ieeestd ports/not radius/.initial=0.154} +\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why +% the suggested xnor distance is is 1.24, so 1.25/3.25/2 +% xor/xnor leads go full in in IEEE; let this be optional +\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}% +\ctikzset{ieeestd ports/xor leads in/.initial=1}% +% +% base size of a small external schmitt symbol +% +\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}% +% +% input management +% we are using the same /tikz/number inputs than the legacy ports +% +\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner +% +% integrate with the other logic ports +% +% +\newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse +\ctikzset{logic ports/ieee/.code= {% + \pgf@circuit@ieeelogicporttrue + \pgf@circuit@europeanlogicportfalse + \tikzset{and port/.style={shape=ieeestd and port}}% + \tikzset{or port/.style={shape=ieeestd or port}}% + \tikzset{xor port/.style={shape=ieeestd xor port}}% + \tikzset{buffer port/.style={shape=ieeestd buffer port}}% + \tikzset{not port/.style={shape=ieeestd not port}}% + \tikzset{nand port/.style={shape=ieeestd nand port}}% + \tikzset{nor port/.style={shape=ieeestd nor port}}% + \tikzset{xnor port/.style={shape=ieeestd xnor port}}% + \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}% + \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}% +}} +% add code to be compatible with the other ports +\ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}} +\ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}} +\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}} +% +% the base angle for the or port. See the drawings. This will not change with height +% +\pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)} +% \typeout{ANGLE-IS\space\pgf@circ@orangle} +\def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgf@circ@res@step=\pind + \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen +}% + +% #1 = \pgfmathcounter #2=type +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor +\def\pgf@circ@ieeeport@baseinput#1#2% +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + % Find the vertical position (this is the same for any port) + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 + % border anchors for rack should be ok + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextractx{\pgf@circ@res@right}{\bodyleft} + \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left + % we have finished if we are in the rack + \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b + % we are on the inner ports; we have to do the hard work here + % and and nand + \ifnum #2=1 + \relax % It's an and/nand, all border ports are on the rack line + \fi + % or and nor + \ifnum #2=2 + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi + % xor and xnor + \ifnum #2=3\relax + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi + \fi\fi +}% +% inner base ports for xor types port +% #1 = \pgfmathcounter #2=type +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor +\def\pgf@circ@ieeeport@innerbaseinput#1% +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + % Find the vertical position (this is the same for any port) + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 + % border anchors for rack should be ok + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextractx{\pgf@circ@res@right}{\bodyleft} + \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left + % we have finished if we are in the rack + \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b + % we are on the inner ports; we have to do the hard work here + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi\fi +}% + +%%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp +\def\pgf@circ@ieeestd@baselen{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@stdH{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@pinlen{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@xorbar{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen} +} +%% Not circle +\def\pgf@circ@notradius{ + \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp} + % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp} +} +%% Find (in ...@other) the height of the rack +\def\pgf@circ@findrackH{% + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% + \pgf@circ@ieeestd@stdH + \multiply\pgf@circ@res@temp by 2\relax% full height + \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port + % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other} +} +%% +\def\pgf@circ@find@ieeeport@up{% leave it in up + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp} + % rack top size + \pgf@circ@findrackH + \ifdim\pgf@circ@res@other > \pgf@circ@res@up + \pgf@circ@res@up=\pgf@circ@res@other + \else + \fi +} +\def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5} + \pgf@circ@res@right=\pgf@circ@res@left % save the border value + \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp + % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + % this is the normal left border + % For the or or xor port, the limit can be the pointy thing (in case the + % pinlen is zero or too small) + % add to the body margin the or/nor peak: + \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))} + \advance\pgf@circ@res@right by \pgf@circ@res@other + % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \fi + % add to the body margin the xor/xnor distance + \ifnum #1 = 3\relax% "xor" or "xnor" gates. + \pgf@circ@ieeestd@xorbar + \advance\pgf@circ@res@right by \pgf@circ@res@temp + % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \fi + % and if this exceeds the normal margin, this is it + % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \ifdim \pgf@circ@res@right > \pgf@circ@res@left + \pgf@circ@res@left=\pgf@circ@res@right + \fi + % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \pgf@circ@res@left=-\pgf@circ@res@left +} +\def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5} + \pgf@circ@notradius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp + \ifdim\pgf@circ@res@other > \pgf@circ@res@right + \pgf@circ@res@right=\pgf@circ@res@other + \fi +} +\def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated + % Normal port limits + \pgf@circ@ieeestd@stdH + % notice 0.8660254 is cos(30) + \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp} + \pgf@circ@notradius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp + \ifdim\pgf@circ@res@other > \pgf@circ@res@right + \pgf@circ@res@right=\pgf@circ@res@other + \fi +} + + +%%% ieeestd multi-input ports +%%% #1: name +%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor +%%% #3: polarity: 0 for direct, 1 for inverted (not at the output) +%%% #4: drawing for the port +\long\def\pgfcircdeclareieeeport#1#2#3#4{% + \pgfdeclareshape{ieeestd #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\pind}{% pin distance; + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% + \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height + \divide\pgf@x by \pgf@circ@count@b + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\xorbar}{% + \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar + \pgf@circ@ieeestd@stdH + \pgf@circ@res@other=0pt\relax + \ifnum #2 = 2\relax% "or" or "nor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))} + \fi + \ifnum #2 = 3\relax% "xor" or "xnor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle)) + +\pgf@circ@res@right} + \fi + \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle + \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp + \pgf@circ@ieeestd@stdH + % #3 is =1 if the port is a negated output one + \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@left{#2} + % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up} + \pgf@x=\pgf@circ@res@left + \pgf@y=\pgf@circ@res@up + } + \savedanchor{\southwest}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@left{#2} + \pgf@x=\pgf@circ@res@left + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\southeast}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@right{#3} + \pgf@x=\pgf@circ@res@right + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\northeast}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@right{#3} + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up + } + \savedmacro\inputs{% get number of inputs + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax + \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins + % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi + \def\inputs{\the\pgf@circ@count@a}% + }% + \savedmacro\inners{% get number of "inner" inputs (for racks) + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi + % \typeout{INNER is \the\pgf@circ@count@b}% + % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi + \def\inners{\the\pgf@circ@count@b}% + }% + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border + \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % create input anchors + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{% + \pgf@circ@count@a=\inputs + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@circ@count@a% + \else% + %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above + }% + \ifnum #2 = 3\relax % xor/xnor inner border pins + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above + }% + \fi + %}{}% + \repeatpgfmathloop% + } + % output anchor + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{% central edge of the component + \bodyleft\pgf@y=0pt + \ifnum #2=3\relax + \advance\pgf@x by -\xorbar + \fi + } + \anchor{up}{% + \bodyleft + \ifnum #2 > 1 % pointy shapes + \pgf@circ@ieeestd@stdH + % horizontal coordinate where the right semicircle starts + \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} + % vertical drop of the circle at the above coordinate + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} + \advance \pgf@y by -\pgf@circ@res@step + \fi + \pgf@x=0pt + } + \anchor{down}{% + \bodyleft + \ifnum #2 > 1 % pointy shapes + \pgf@circ@ieeestd@stdH + % horizontal coordinate where the right semicircle starts + \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} + % vertical drop of the circle at the above coordinate + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} + \advance \pgf@y by -\pgf@circ@res@step + \fi + \pgf@y=-\pgf@y\pgf@x=0pt + } + + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + #4 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + \ifnum #3=1\relax\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope\fi + } + } +} + +%%% #1 direct name #2 negated name #3 type #4 drawing (without output) +\long\def\pgfcircdeclareieeeportpair#1#2#3#4{% + \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct + \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated +} +% +% ieeestd "and" and "nand" +% +\pgfcircdeclareieeeportpair{and}{nand}{1}{% + \pgf@circ@count@a = \inputs\relax + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@down}{\bodyleft} + \ifpgfcirc@draw@input@leads + %input leads --- all the same for AND ports + \loop\ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@res@temp by -\pind + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% + \advance\pgf@circ@count@a by -1 + \repeat + \fi + \pgfusepath{draw} + %% Body. let's start from the top left + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} + \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}} + \pgfpatharc{90}{-90}{\stdH} + \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}} + \pgfpathclose + \pgf@circ@draworfill + % rack now; skip if not needed. + % \typeout{WHAT\space \inputs\space \inners} + \ifnum\inputs>\inners + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \endpgfscope +} +% +% or/nor and xor/xnor are practically the same. Let factor out everything +% the argument #1 is put just before the drawing of the inner pins +% the argument #2 is put after the drawing of the body +% +\long\def\pgf@circ@ieeeport@orxor#1#2{% + \pgf@circ@count@a = \inputs\relax + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@down}{\bodyleft} + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1 + \ifpgfcirc@draw@input@leads + %input leads --- for or ports + \loop\ifnum\pgf@circ@count@a>0 + \pgfextractx{\pgf@circ@res@right}{\topleft} + \advance\pgf@circ@res@temp by -\pind + % this is the height; let's find the "right" position + \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c + % inner pins + % \typeout{INNER\space\pgf@circ@count@a} + \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))} + % hook for xor/xnor + #1 + \fi\fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% + \pgfusepath{draw} + \advance\pgf@circ@count@a by -1 + \repeat + \fi + %% Body. let's start from the top left + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + % it should start here, but with this trick the close comes out better. + % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} + \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} % + \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}} + \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}} + \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} + %% this should be 2 and 2; but the round part is not a perfect circle that way + %% so the 2.15 is ajusted "by taste" to touch the anchors exactly. + \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfpathclose + \pgf@circ@draworfill + % hook for xor/xnor + #2 + % rack now; skip if not needed. + % \typeout{WHAT\space \inputs\space \inners} + \ifnum\inputs>\inners + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextracty{\pgf@circ@res@down}{\topleft} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \endpgfscope +} +% +% ieeestd "or" and "nor" +% +\pgfcircdeclareieeeportpair{or}{nor}{2}{% + \pgf@circ@ieeeport@orxor{}{} +} +\pgfcircdeclareieeeportpair{xor}{xnor}{3}{% + \pgf@circ@ieeeport@orxor{ + \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}} + \ifnum\@@tmp=0\relax + % move pin start to the left to leave the xor gap free (not standard) + \advance\pgf@circ@res@right by -\xorbar + \fi + }{% + % add the xor/xnor bar + \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} + % see the comment on the main body about the 2.2 + \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfusepath{draw} + } +} +% +% Buffer and inverters +% +% #1: name +% #2: polarity +% #3: content +\long\def\pgfcircdeclareieeebufferport#1#2#3{% + \pgfdeclareshape{ieeestd #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + % Notice that 0.8660254 is cos(30) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle + \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp + \pgf@circ@ieeestd@stdH + % #2 is =1 if the port is a negated output one + \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\southwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + \savedanchor{\southeast}{% + \pgf@circ@ieeestd@stdH + \pgf@circ@res@up=\pgf@circ@res@temp + \pgf@circ@find@ieeeport@not@right{#2} + \pgf@x=\pgf@circ@res@right + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\northeast}{% + \pgf@circ@ieeestd@stdH + \pgf@circ@res@up=\pgf@circ@res@temp + \pgf@circ@find@ieeeport@not@right{#2} + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up + } + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % input anchors + \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{bin}{\bodyleft\pgf@y=0pt\relax} + \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} + % output anchors + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{\bodyleft\pgf@y=0pt} + \anchor{up}{% + \bodyleft + \pgf@y=+0.5\pgf@y\pgf@x=0pt + } + \anchor{down}{% + \bodyleft + \pgf@y=-0.5\pgf@y\pgf@x=0pt + } + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + %% This (commented out) is the correct border anchor. But if we use the correct + %% border anchor there is no horizontal space for the label ;-) because + %% the triangle is too steep. So we will use a simple square border + %% + %% find the border anchor of a triangle (like a not port or an + %% amplifier) --- + %% + %% -----^ up + %% I --- | + %% I -|-- + %%left I | --- right + %% ----I-----|-------I----- + %% + %% + %\pgf@xa=\pgf@x + %% it's simmetrical w/ vertical side, use only positive y + %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + %\pgfextracty{\pgf@circ@res@up}{\bodyleft} + %\pgfextractx{\pgf@circ@res@left}{\bodyleft} + %\pgfextractx{\pgf@circ@res@right}{\bodyright} + %% limit angle for the left (vertical) side + %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)} + %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)} + %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)} + %% find the border + %\ifnum\@@leftside>0 + % % vertical side + % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + %\else + % % triangle upper line + % \pgfpointintersectionoflines + % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}} + %\fi + %% readjust y sign + %\pgf@y=\@@switchy\pgf@y + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + #3 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + \ifnum #2=1\relax\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope\fi + } + } +} + +%%% #1 direct name #2 negated name #3 drawing (without output) +\long\def\pgfcircdeclareieeebufferportpair#1#2#3{% + \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct + \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated +} + +\pgfcircdeclareieeebufferportpair{buffer}{not}{% + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pin + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope +} + +\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{% + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pin + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % draw schmitt symbol in normal line thickness + \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfusepath{draw} +} + + +\pgfdeclareshape{schmitt symbol}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@circ@ieeestd@stdH + \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp + \pgf@x=-1.5\pgf@y + } + \anchor{center}{\pgf@y=0pt \pgf@x=0pt} + \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt} + \anchor{w}{\northwest \pgf@y=0pt} + \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{north}{\northwest\pgf@x=0pt} + \anchor{n}{\northwest\pgf@x=0pt} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{north west}{\northwest} + \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgf@circ@res@left=0.7\pgf@circ@res@left + \pgf@circ@res@up=0.7\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + } +} + +\pgfdeclareshape{notcirc}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@circ@notradius + \pgf@y=\pgf@circ@res@temp + \pgf@x=-\pgf@y + } + \anchor{center}{\pgf@y=0pt \pgf@x=0pt} + \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} + \anchor{left}{\northwest\pgf@y=0pt} + \anchor{west}{\northwest\pgf@y=0pt} + \anchor{w}{\northwest \pgf@y=0pt} + \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{north}{\northwest\pgf@x=0pt} + \anchor{n}{\northwest\pgf@x=0pt} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{north west}{\northwest} + \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \northwest\pgf@circ@res@temp=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}% + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + } + \behindforegroundpath{ + \pgfscope + \northwest\pgf@circ@res@temp=\pgf@y + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%%%% Transmission gates +% tgates are only ieee style for now +\tikzset{% + tgate/.style ={shape=ieee tgate}, + double tgate/.style ={shape=ieee double tgate}, +} +\ctikzset{tgate scale/.initial=0.7} +% Buffer and inverters +% +% #1: name +% #2: 1: one-not, 2:double-not +% #3: content +\long\def\pgfcircdeclareieeetgate#1#2#3{% + \pgfdeclareshape{ieee #1}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\notradius}{ + \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + % Notice that 0.8660254 is cos(30) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\bodyright}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\bottomright}{% Here it is the same as \bodyright + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\southwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\southeast}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\northeast}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % input anchors + \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{bin}{\bodyleft\pgf@y=0pt\relax} + \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} + % gates + \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} + \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}} + % gate (up) (2.1547 = 1+1/cos(30) + \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} + \ifdim\pinlen>\pgf@circ@res@temp + \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen} + \else + \pgf@y=\pgf@circ@res@temp + \fi + } + \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}} + + % output anchors + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{\bodyleft\pgf@y=0pt} + \anchor{up}{% + \bodyleft + \pgf@x=0pt + \ifnum#2=1\relax + \pgf@y=0pt + \else + \pgf@y=.5\pgf@y + \fi + \advance\pgf@y by \notdiameter + } + \anchor{down}{% + \bodyleft + \pgf@x=0pt + \ifnum#2=1\relax + \pgf@y=0pt + \else + \pgf@y=-.5\pgf@y + \fi + } + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pins + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + % gate (down) + \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} + % gate (up) (2.1547 = 1+1/cos(30) + \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} + \ifdim\pinlen>\pgf@circ@res@temp + \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}} + \fi + \pgfusepath{draw} + \fi + #3 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + } + } +} + +\pgfcircdeclareieeetgate{tgate}{1}{% + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfscope + % 1.1547 is 1/cos(30) + \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}} + \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope +} + +\pgfcircdeclareieeetgate{double tgate}{2}{% + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + % bottom triangles + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfscope + % 1.1547 is 1/cos(30) + \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}} + \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope +}% %>>> + +%% Path-style definitions for logical ports%<<< +% +% create path-style element for one input --- one output logical ports +% +\def\pgfcirc@port@node@to@path#1#2{% + % + % add a logic port path style component --- we need to suppress leads + % and use the correct center + % + \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}% +} +\pgfcirc@port@node@to@path{not port}{inline not} +\pgfcirc@port@node@to@path{buffer port}{inline buffer} +\pgfcirc@port@node@to@path{schmitt port}{inline schmitt} +\pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt} + +\pgfcirc@port@node@to@path{tgate}{inline tgate} +\pgfcirc@port@node@to@path{double tgate}{inline double tgate} +% %>>> %%%%%%%%%%%%%%%%%%%%%%%% %% Transistors %%%%%%%%%%%%%%%%%%%%%%%% +% Settings for Transistors %<<<1 + +\newif\ifpgf@circuit@trans@depletiontype +\pgf@circuit@trans@depletiontypefalse + +\newif\ifpgf@circuit@mos@arrows +\ctikzset{tripoles/mos style/.is choice} +\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} +\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} + +% Fixed label positions +\newif\ifpgf@circuit@transisors@fixlabels +\pgf@circuit@transisors@fixlabelstrue +\pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} +\ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} +\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} +\ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} + +% Option solderdot for fet +\newif\ifpgf@circuit@fet@solderdot +\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} +\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} + +% Option bodydiode for fet +\newif\ifpgf@circuit@fet@bodydiode +\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} +\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} + +% Option draw fet without gate connection +\newif\ifpgf@circuit@bpt@drawgate +\pgf@circuit@bpt@drawgatetrue +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} + +% Option draw bpt with schottky base +\newif\ifpgf@circuit@bpt@schottky +\pgf@circuit@bpt@schottkyfalse +\pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} +\ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} +\pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} +\ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} +\ctikzset{tripoles/schottky base size/.initial=0.05} + +% Option draw bpt without base connection +\newif\ifpgf@circuit@bpt@drawbase +\pgf@circuit@bpt@drawbasetrue +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} + +% Option draw bpt with optical input +\newif\ifpgf@circuit@bpt@drawphoto +\pgf@circuit@bpt@drawphotofalse +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} + +% Option draw fet without bulk connection -- Added by Burak Kelleci +\newif\ifpgf@circuit@bpt@drawbulk +\pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} +\ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} +\pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} +\ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} + +% Option draw pmos with empty circle +\newif\ifpgf@circuit@pmos@emptycircle +\pgf@circuit@pmos@emptycirclefalse +\ctikzset{tripoles/pmos style/.is choice} +\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +% Option draw pmos with no circle +\newif\ifpgf@circuit@pmos@nocircle +\pgf@circuit@pmos@nocirclefalse +\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +% back to normal +\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +% arrows at the end, the correct way +\newif\ifpgf@circuit@trans@arrowatend +\pgf@circuit@trans@arrowatendfalse +\ctikzset{transistors/arrow pos/.is choice} +\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} +\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} + +\newif\ifpgf@circuit@trans@ntype +\pgf@circuit@trans@ntypetrue %default true +%\newif\ifpgf@circuit@trans@ptype +%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}} +\ctikzset{tripoles/nmos/width/.initial=.7} +\ctikzset{tripoles/nmos/gate height/.initial=.35} +\ctikzset{tripoles/nmos/base height/.initial=.5} +\ctikzset{tripoles/nmos/conn height/.initial=0} +\ctikzset{tripoles/nmos/height/.initial=1.1} +\ctikzset{tripoles/nmos/base width/.initial=.5} +\ctikzset{tripoles/nmos/gate width/.initial=.62} +\ctikzset{tripoles/nmos/arrow pos/.initial=.6} +\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nmos/curr direction/.initial=1} + +\ctikzset{tripoles/pmos/width/.initial=.7} +\ctikzset{tripoles/pmos/gate height/.initial=.35} +\ctikzset{tripoles/pmos/base height/.initial=.5} +\ctikzset{tripoles/pmos/conn height/.initial=0} +\ctikzset{tripoles/pmos/height/.initial=1.1} +\ctikzset{tripoles/pmos/base width/.initial=.5} +\ctikzset{tripoles/pmos/gate width/.initial=.62} +\ctikzset{tripoles/pmos/arrow pos/.initial=.4} +\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pmos/curr direction/.initial=-1} + +\ctikzset{tripoles/nmosd/width/.initial=.7} +\ctikzset{tripoles/nmosd/gate height/.initial=.35} +\ctikzset{tripoles/nmosd/base height/.initial=.5} +\ctikzset{tripoles/nmosd/conn height/.initial=0} +\ctikzset{tripoles/nmosd/height/.initial=1.1} +\ctikzset{tripoles/nmosd/base width/.initial=.5} +\ctikzset{tripoles/nmosd/gate width/.initial=.62} +\ctikzset{tripoles/nmosd/arrow pos/.initial=.6} +\ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nmosd/curr direction/.initial=1} +\ctikzset{tripoles/nmosd/depletion width/.initial=.1} +\ctikzset{tripoles/nmosd/depletion color/.initial=default} + +\ctikzset{tripoles/pmosd/width/.initial=.7} +\ctikzset{tripoles/pmosd/gate height/.initial=.35} +\ctikzset{tripoles/pmosd/base height/.initial=.5} +\ctikzset{tripoles/pmosd/conn height/.initial=0} +\ctikzset{tripoles/pmosd/height/.initial=1.1} +\ctikzset{tripoles/pmosd/base width/.initial=.5} +\ctikzset{tripoles/pmosd/gate width/.initial=.62} +\ctikzset{tripoles/pmosd/arrow pos/.initial=.4} +\ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pmosd/curr direction/.initial=-1} +\ctikzset{tripoles/pmosd/depletion width/.initial=.1} +\ctikzset{tripoles/pmosd/depletion color/.initial=default} +\ctikzset{tripoles/hemt/width/.initial=.7} +\ctikzset{tripoles/hemt/gate height/.initial=.35} +\ctikzset{tripoles/hemt/base height/.initial=.5} +\ctikzset{tripoles/hemt/conn height/.initial=0} +\ctikzset{tripoles/hemt/height/.initial=1.1} +\ctikzset{tripoles/hemt/base width/.initial=.5} +\ctikzset{tripoles/hemt/gate width/.initial=.62} +\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/hemt/curr direction/.initial=1} + +\ctikzset{tripoles/nfet/width/.initial=.7} +\ctikzset{tripoles/nfet/gate height/.initial=.35} +\ctikzset{tripoles/nfet/base height/.initial=.5} +\ctikzset{tripoles/nfet/conn height/.initial=0} +\ctikzset{tripoles/nfet/height/.initial=1.1} +\ctikzset{tripoles/nfet/base width/.initial=.5} +\ctikzset{tripoles/nfet/gate width/.initial=.62} +\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nfet/curr direction/.initial=1} + +\ctikzset{tripoles/pfet/width/.initial=.7} +\ctikzset{tripoles/pfet/gate height/.initial=.35} +\ctikzset{tripoles/pfet/base height/.initial=.5} +\ctikzset{tripoles/pfet/conn height/.initial=0} +\ctikzset{tripoles/pfet/height/.initial=1.1} +\ctikzset{tripoles/pfet/base width/.initial=.5} +\ctikzset{tripoles/pfet/gate width/.initial=.62} +\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pfet/curr direction/.initial=-1} + +\ctikzset{tripoles/nfetd/width/.initial=.7} +\ctikzset{tripoles/nfetd/gate height/.initial=.35} +\ctikzset{tripoles/nfetd/base height/.initial=.5} +\ctikzset{tripoles/nfetd/conn height/.initial=0} +\ctikzset{tripoles/nfetd/height/.initial=1.1} +\ctikzset{tripoles/nfetd/base width/.initial=.5} +\ctikzset{tripoles/nfetd/gate width/.initial=.62} +\ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nfetd/curr direction/.initial=1} + +\ctikzset{tripoles/pfetd/width/.initial=.7} +\ctikzset{tripoles/pfetd/gate height/.initial=.35} +\ctikzset{tripoles/pfetd/base height/.initial=.5} +\ctikzset{tripoles/pfetd/conn height/.initial=0} +\ctikzset{tripoles/pfetd/height/.initial=1.1} +\ctikzset{tripoles/pfetd/base width/.initial=.5} +\ctikzset{tripoles/pfetd/gate width/.initial=.62} +\ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pfetd/curr direction/.initial=-1} + +\ctikzset{tripoles/nigfete/width/.initial=.7} +\ctikzset{tripoles/nigfete/gate height/.initial=.35} +\ctikzset{tripoles/nigfete/base height/.initial=.5} +\ctikzset{tripoles/nigfete/conn height/.initial=.35} +\ctikzset{tripoles/nigfete/height/.initial=1.1} +\ctikzset{tripoles/nigfete/base width/.initial=.5} +\ctikzset{tripoles/nigfete/gate width/.initial=.62} +\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfete/curr direction/.initial=1} + +\ctikzset{tripoles/nigfetd/width/.initial=.7} +\ctikzset{tripoles/nigfetd/gate height/.initial=.35} +\ctikzset{tripoles/nigfetd/base height/.initial=.5} +\ctikzset{tripoles/nigfetd/conn height/.initial=.35} +\ctikzset{tripoles/nigfetd/height/.initial=1.1} +\ctikzset{tripoles/nigfetd/base width/.initial=.5} +\ctikzset{tripoles/nigfetd/gate width/.initial=.62} +\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfetd/curr direction/.initial=1} + +\ctikzset{tripoles/nigfetebulk/width/.initial=.7} +\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35} +\ctikzset{tripoles/nigfetebulk/base height/.initial=.5} +\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35} +\ctikzset{tripoles/nigfetebulk/height/.initial=1.1} +\ctikzset{tripoles/nigfetebulk/base width/.initial=.5} +\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62} +\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1} + +\ctikzset{tripoles/pigfete/width/.initial=.7} +\ctikzset{tripoles/pigfete/gate height/.initial=.35} +\ctikzset{tripoles/pigfete/base height/.initial=.5} +\ctikzset{tripoles/pigfete/conn height/.initial=.35} +\ctikzset{tripoles/pigfete/height/.initial=1.1} +\ctikzset{tripoles/pigfete/base width/.initial=.5} +\ctikzset{tripoles/pigfete/gate width/.initial=.62} +\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfete/curr direction/.initial=-1} + +\ctikzset{tripoles/pigfetd/width/.initial=.7} +\ctikzset{tripoles/pigfetd/gate height/.initial=.35} +\ctikzset{tripoles/pigfetd/base height/.initial=.5} +\ctikzset{tripoles/pigfetd/conn height/.initial=.35} +\ctikzset{tripoles/pigfetd/height/.initial=1.1} +\ctikzset{tripoles/pigfetd/base width/.initial=.5} +\ctikzset{tripoles/pigfetd/gate width/.initial=.62} +\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfetd/curr direction/.initial=-1} + +\ctikzset{tripoles/pigfetebulk/width/.initial=.7} +\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35} +\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35} +\ctikzset{tripoles/pigfetebulk/base height/.initial=.5} +\ctikzset{tripoles/pigfetebulk/height/.initial=1.1} +\ctikzset{tripoles/pigfetebulk/base width/.initial=.5} +\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62} +\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1} + +\ctikzset{tripoles/npn/width/.initial=.6} +\ctikzset{tripoles/npn/base height/.initial=.45} +\ctikzset{tripoles/npn/base height 2/.initial=.15} +\ctikzset{tripoles/npn/base height/.initial=.4} +\ctikzset{tripoles/npn/conn height/.initial=0} +\ctikzset{tripoles/npn/height/.initial=1.1} +\ctikzset{tripoles/npn/base width/.initial=.5} +\ctikzset{tripoles/npn/arrow pos/.initial=.5} +\ctikzset{tripoles/npn/bodydiode scale/.initial=.3} +\ctikzset{tripoles/npn/bodydiode distance/.initial=.3} +\ctikzset{tripoles/npn/bodydiode conn/.initial=.6} +\ctikzset{tripoles/npn/curr direction/.initial=1} + +\ctikzset{tripoles/pnp/width/.initial=.6} +\ctikzset{tripoles/pnp/base height/.initial=.45} +\ctikzset{tripoles/pnp/base height 2/.initial=.15} +\ctikzset{tripoles/pnp/base height/.initial=.4} +\ctikzset{tripoles/pnp/conn height/.initial=0} +\ctikzset{tripoles/pnp/height/.initial=1.1} +\ctikzset{tripoles/pnp/base width/.initial=.5} +\ctikzset{tripoles/pnp/arrow pos/.initial=.5} +\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pnp/curr direction/.initial=-1} + +\ctikzset{tripoles/pigbt/width/.initial=.6} +\ctikzset{tripoles/pigbt/gate height/.initial=.45} +\ctikzset{tripoles/pigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/pigbt/base height/.initial=.4} +\ctikzset{tripoles/pigbt/outer base height/.initial=.4} +\ctikzset{tripoles/pigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/pigbt/conn height/.initial=0} +\ctikzset{tripoles/pigbt/height/.initial=1.1} +\ctikzset{tripoles/pigbt/gate width/.initial=.62} +\ctikzset{tripoles/pigbt/base width/.initial=.5} +\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigbt/curr direction/.initial=-1} + +\ctikzset{tripoles/nigbt/width/.initial=.6} +\ctikzset{tripoles/nigbt/gate height/.initial=.45} +\ctikzset{tripoles/nigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/nigbt/base height/.initial=.4} +\ctikzset{tripoles/nigbt/outer base height/.initial=.4} +\ctikzset{tripoles/nigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/nigbt/conn height/.initial=0} +\ctikzset{tripoles/nigbt/height/.initial=1.1} +\ctikzset{tripoles/nigbt/gate width/.initial=.62} +\ctikzset{tripoles/nigbt/base width/.initial=.5} +\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigbt/curr direction/.initial=1} + +\ctikzset{tripoles/Lpigbt/width/.initial=.6} +\ctikzset{tripoles/Lpigbt/gate height/.initial=.45} +\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/Lpigbt/base height/.initial=.4} +\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4} +\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/Lpigbt/conn height/.initial=.4} +\ctikzset{tripoles/Lpigbt/height/.initial=1.1} +\ctikzset{tripoles/Lpigbt/gate width/.initial=.62} +\ctikzset{tripoles/Lpigbt/base width/.initial=.5} +\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1} + +\ctikzset{tripoles/Lnigbt/width/.initial=.6} +\ctikzset{tripoles/Lnigbt/gate height/.initial=.45} +\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/Lnigbt/base height/.initial=.4} +\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4} +\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/Lnigbt/conn height/.initial=.4} +\ctikzset{tripoles/Lnigbt/height/.initial=1.1} +\ctikzset{tripoles/Lnigbt/gate width/.initial=.62} +\ctikzset{tripoles/Lnigbt/base width/.initial=.5} +\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/Lnigbt/curr direction/.initial=1} + +\ctikzset{tripoles/igbt/outer base height/.code={ + \ctikzset{tripoles/nigbt/outer base height/.initial=#1} + \ctikzset{tripoles/pigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lnigbt/conn height/.initial=#1} + \ctikzset{tripoles/Lpigbt/conn height/.initial=#1} +}} +\ctikzset{tripoles/igbt/outer base thickness/.code={ + \ctikzset{tripoles/nigbt/outer base thickness=#1} + \ctikzset{tripoles/pigbt/outer base thickness=#1} + \ctikzset{tripoles/Lnigbt/outer base thickness=#1} + \ctikzset{tripoles/Lpigbt/outer base thickness=#1} +}} + +\ctikzset{tripoles/njfet/width/.initial=.7} +\ctikzset{tripoles/njfet/gate height/.initial=.5} +\ctikzset{tripoles/njfet/gate height 2/.initial=.35} +\ctikzset{tripoles/njfet/gate width/.initial=.5} +\ctikzset{tripoles/njfet/conn height/.initial=.35} +\ctikzset{tripoles/njfet/height/.initial=1.1} +\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/njfet/curr direction/.initial=1} + +\ctikzset{tripoles/pjfet/width/.initial=.7} +\ctikzset{tripoles/pjfet/gate height/.initial=.5} +\ctikzset{tripoles/pjfet/gate height 2/.initial=.35} +\ctikzset{tripoles/pjfet/gate width/.initial=.5} +\ctikzset{tripoles/pjfet/conn height/.initial=.35} +\ctikzset{tripoles/pjfet/height/.initial=1.1} +\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pjfet/curr direction/.initial=-1} + +\ctikzset{tripoles/isfet/width/.initial=1} +\ctikzset{tripoles/isfet/gate height/.initial=.35} +\ctikzset{tripoles/isfet/base height/.initial=.5} +\ctikzset{tripoles/isfet/height/.initial=1.1} +\ctikzset{tripoles/isfet/base width/.initial=.3} +\ctikzset{tripoles/isfet/gate width/.initial=.5} +\ctikzset{tripoles/isfet/conn height/.initial=0} +\ctikzset{tripoles/isfet/wave width/.initial=.16} +\ctikzset{tripoles/isfet/wave amp/.initial=.06} +\ctikzset{tripoles/isfet/waves y sep/.initial=.22} +\ctikzset{tripoles/isfet/waves x sep/.initial=.8} +\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/isfet/curr direction/.initial=1} +% +% multi-emitter and multi-collector BJTs by Romano Giannetti +% +\ctikzset{tripoles/bjt/emitters/.initial=1} +\ctikzset{tripoles/bjt/collectors/.initial=1} +\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}} +\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}} +\ctikzset{tripoles/bjt/pins width/.initial=0.3} +\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}} +\ctikzset{tripoles/bjt/multi height/.initial=.5} +\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}} +% +\ctikzset{tripoles/bjt/width/.initial=.3} +\ctikzset{tripoles/bjt/base height 2/.initial=.4} +\ctikzset{tripoles/bjt/base height/.initial=1.1} +\ctikzset{tripoles/bjt/height/.initial=.4} +\ctikzset{tripoles/bjt/base width/.initial=1} +\ctikzset{tripoles/bjt/arrow pos/.initial=.5} +% do NOT touch these two! +\ctikzset{tripoles/bjt/npn/curr direction/.initial=1} +\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1} + + % % definitions for transistor circles % @@ -1587,6 +3293,9 @@ \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse \ctikzset{tr circle/.is if=pgf@circ@trcircle} \tikzset{tr circle/.is if=pgf@circ@trcircle} +%%>>> + +%% definitions of transistor shapes%<<< % % add a circle to the transistor: % @@ -3565,63 +5274,161 @@ } % end of transistors +% %>>> + +%% Transistor's path definitions%<<< + +\pgf@circ@definetranspath{nmos} +\pgf@circ@definetranspath{pmos} +\pgf@circ@definetranspath{nmosd} +\pgf@circ@definetranspath{pmosd} +\pgf@circ@definetranspath{hemt} +\pgf@circ@definetranspath{npn} +\pgf@circ@definetranspath{pnp} +\pgf@circ@definetranspath{nfet} +\pgf@circ@definetranspath{nigfete} +\pgf@circ@definetranspath{nigfetd} +\pgf@circ@definetranspath{nigfetebulk} +\pgf@circ@definetranspath{pfet} +\pgf@circ@definetranspath{pigfete} +\pgf@circ@definetranspath{pigfetd} +\pgf@circ@definetranspath{pigfetebulk} +\pgf@circ@definetranspath{njfet} +\pgf@circ@definetranspath{pjfet} +\pgf@circ@definetranspath{pigbt} +\pgf@circ@definetranspath{nigbt} +\pgf@circ@definetranspath{Lpigbt} +\pgf@circ@definetranspath{Lnigbt}% %>>> -%%%%%%%%%%%%% -%% Switches -%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Amplifiers +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\pgfcircdeclarebipole{ - \anchor{out 1}{ - \northeast - \pgf@y=0cm - } - \anchor{out 2}{ - \northeast - \pgf@y=.8\pgf@y - } +% Settings for Amplifiers%<<<1 +% +% switches for op amps +% changing input polarity +% +\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse +\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +\ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +% +% changing output polarity (for fully diff objects) +% +\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue +\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} +\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} + +% Operational amplifier +\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Fully differential operational amplifier +\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation +\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +\ctikzset{tripoles/en amp/width/.initial=1.7} +\ctikzset{tripoles/en amp/port width/.initial=.7} +\ctikzset{tripoles/en amp/height/.initial=1.6} +\ctikzset{tripoles/en amp/input height/.initial=.3} +\ctikzset{tripoles/en amp/up pos/.initial=.45} +\ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed! +\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} +\tikzset{ + en amp text/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{#1}% + }, + en amp text A/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% + }, } -{\ctikzvalof{tripoles/toggleswitch/height 2}} -{toggleswitch} -{\ctikzvalof{tripoles/toggleswitch/height}} -{\ctikzvalof{tripoles/toggleswitch/width}} -{ - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} - \pgfusepath{draw} - \pgfscope - \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} - \pgfusepath{draw} +% Transconductance amplifier +\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid +\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} +% Instrumentation amplifier +\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - \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} - \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfsetdash{}{0cm} +% Instrumentation amplifier with differential output +\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation +\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Instrumentation amplifier with gain resistor terminals +\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width +\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid +\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid +\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation +\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation +\ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Plain amplifier +\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position + +% changing fonts and symbols of amplifiers +\ctikzset{amplifiers/symbol font/.code={% + \ctikzset{tripoles/inst amp ra/font=#1}% + \ctikzset{tripoles/fd inst amp/font=#1}% + \ctikzset{tripoles/inst amp/font=#1}% + \ctikzset{tripoles/gm amp/font=#1}% + \ctikzset{tripoles/en amp/font=#1}% + \ctikzset{tripoles/fd op amp/font=#1}% + \ctikzset{tripoles/op amp/font=#1}% +}} +\ctikzset{amplifiers/plus/.initial={$+$}} +\ctikzset{amplifiers/minus/.initial={$-$}} +\tikzset{amp symbol font/.code={% + \ctikzset{amplifiers/symbol font={#1}}% + } } +\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}} +\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} +\def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} +\def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} +%%>>> -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Nodes for amplifiers%<<< %% operational and instrumentation amplifiers -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfdeclareshape{op amp} { @@ -5706,152 +7513,43 @@ \pgfusepath{draw} } -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% electromechanical device (motor/generator) -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +}% %>>> -\pgfdeclareshape{elmech} -{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedanchor\northwest{ - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - } - \anchor{center}{ - \pgfpointorigin - } - \anchor{text}{ - \pgfpointorigin - \advance \pgf@x by -.5\wd\pgfnodeparttextbox - \advance \pgf@y by -.5\ht\pgfnodeparttextbox - } - \anchor{left}{% - \northwest - \pgf@y=0pt - } - \anchor{right}{% - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{top}{ - \northwest - \pgf@x=0pt - } - \anchor{pathstart}{ - \northwest - \pgf@x=0pt - } - \anchor{pathend}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{bottom}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{north}{ - \northwest - \pgf@x=0pt - } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchorborder{% - \@tempdima=\pgf@x\@tempdimb=\pgf@y - \northwest\pgf@circ@res@other=-\pgf@x - \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}} - } - \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x} - \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y} - \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x} - \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y} - \anchor{block up right}{ - \northwest - % remember that pgf@x is negative - % center of the block is at 0.5*H+W*cos(30)/2 - \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax - \pgf@x=-0.5\pgf@x - } - \anchor{block up left}{ - \northwest - % remember that pgf@x is negative - % center of the block is at 0.5*H+W*cos(30)/2 - \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax - \pgf@x=0.5\pgf@x - } - \anchor{block down right}{ - \northwest - % remember that pgf@x is negative - % center of the block is at 0.5*H+W*cos(30)/2 - \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax - \pgf@y=-\pgf@y - \pgf@x=-0.5\pgf@x - } - \anchor{block down left}{ - \northwest - % remember that pgf@x is negative - % center of the block is at 0.5*H+W*cos(30)/2 - \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax - \pgf@y=-\pgf@y - \pgf@x=0.5\pgf@x - } - \behindbackgroundpath{ - \pgfsetcolor{\ctikzvalof{color}} - \pgf@circ@scaled@Rlen=\scaledRlen - \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen - \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen - \pgfscope - \pgfstartlinewidth=\pgflinewidth - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfscope % clip the bar: whole size minus the circle - \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} - \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} - \pgfseteorule - \pgfusepath{clip} - \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfsetfillcolor{\ctikzvalof{color}} - \pgfusepath{fill, draw} - \endpgfscope - \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} - \ifx\tikz@fillcolor\pgfutil@empty - % set the default fill color to white - \pgfsetfillcolor{white} - % ...but override it if the class is defined! - \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} - \else - \pgfsetfillcolor{\tikz@fillcolor} - \pgfusepath{draw, fill} - \fi - \endpgfscope - } -} +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Tubes and magnetron +%%%%%%%%%%%%%%%%%%%%%%%% + +% Settings Electronic tubes: diodetube, triode, tetrode and pentode%<<<1 +\ctikzset{tubes/width/.initial=1} % relative width +\ctikzset{tubes/height/.initial=1.4} % relative height +\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle +\ctikzset{tubes/anode distance/.initial=0.40} % distance from center +\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate +\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center +\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes +\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids +\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center +\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid +\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode +\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire +\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side +\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode +\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint + +\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} + +\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse +\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse +\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse +\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} +\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}% +%>>> + +%% Node shapes for tubes & co%<<< %%%%%%%%%%%%%%%%%%% %% Magnetron @@ -6427,6 +8125,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} -} +}% %>>> \endinput +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex index 58420725ad9..9400b0c7011 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex index d6c11db0405..9a393d7d098 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -13,7 +13,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Voltage management -%% styles +%% styles%<<< \ctikzset{bipole voltage style/.style={}} \tikzset{bipole voltage style/.code={ \ctikzset{bipole voltage style/.style={#1}} @@ -23,37 +23,37 @@ }} \ctikzset{v^>/.style = { - v = #1, + v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward, \circuitikzbasekey/bipole/voltage/position = above } } \ctikzset{v^</.style = { - v = #1, + v={#1}, \circuitikzbasekey/bipole/voltage/direction = backward, \circuitikzbasekey/bipole/voltage/position = above } } \ctikzset{v_>/.style = { - v = #1, + v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward, \circuitikzbasekey/bipole/voltage/position = below } } \ctikzset{v_</.style = { - v = #1, + v={#1}, \circuitikzbasekey/bipole/voltage/direction = backward, \circuitikzbasekey/bipole/voltage/position = below } } -\ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = below} } -\ctikzset{v^/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = above} } -\ctikzset{v>/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} } -\ctikzset{v</.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = backward} } +\ctikzset{v_/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = below} } +\ctikzset{v^/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = above} } +\ctikzset{v>/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward} } +\ctikzset{v</.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = backward} }% % Default position varies whether the component is a voltage source % or not @@ -85,7 +85,7 @@ \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below, \circuitikzbasekey/bipole/voltage/direction=backward} \fi\fi\fi - \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name={#1}} \ctikzsetvalof{bipole/voltage/label/unit}{} \ifpgf@circ@siunitx \pgf@circ@handleSI{#1} @@ -100,6 +100,7 @@ \fi } } +% %>>> % american voltage font selection and symbol definition % the default font command is {} --- nothing @@ -123,7 +124,7 @@ \fi } -%% Output routine for generic bipoles +%% Output routine for generic bipoles%<<< % put this to true to see the voltage label coordinate anchors \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse @@ -342,8 +343,9 @@ \fi \fi % Closing the ...ifempty } +% %>>> -%% Output routine for voltage sources +%% Output routine for voltage sources%<<< \def\pgf@circ@drawvoltagegenerator{ % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a. % it's not perfect, but I can't find the way to do it correctly... @@ -414,8 +416,9 @@ \fi \fi % closes ...ifempty } +% %>>> -%% Output routine +%% Output routine (main entry point) %<<< %% this is the entry point %% %% locally used dimensions @@ -626,4 +629,65 @@ \fi }%end drawvoltages + +% %>>> + +%% these should be arguably moved to every component definition... + +% special cases for voltage positions%<<<1 +% the KIND is the node name without SHAPE +% See the definition above for meaning +% if bipoles/KIND/voltage/straight label distance is not defined, it uses the height +% if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance) +% +\ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4} +\ctikzset{bipoles/generic/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/memristor/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4} +% +\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4} +\ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8} +% +\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6} +% +\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4} +\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6} +\ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6} +\ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8} +% +\ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2} +% +\ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5} +\ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0} +\ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5} +\ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0} +\ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0} +\ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2} +\ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0} +\ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2} +\ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8} +\ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8} +\ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8} +% +\ctikzset{bipoles/short/voltage/american label distance/.initial=2.8} +\ctikzset{bipoles/open/voltage/distance from node/.initial=0.3} +% +\ctikzset{bipoles/battery/voltage/bump a/.initial=1.4} +\ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2} +\ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2} +%%>>> + \endinput +% vim: set fdm=marker fmr=%<<<,%>>>: |