From 080ac5381f901946a1b4558ef16853881a4dbcb9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 2 May 2021 20:41:58 +0000 Subject: circuitikz (2may21) git-svn-id: svn://tug.org/texlive/trunk@59054 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/context/third/circuitikz/t-circuitikz.tex | 4 +- .../tex/generic/circuitikz/ctikzstyle-legacy.tex | 1 + .../tex/generic/circuitikz/ctikzstyle-romano.tex | 2 + .../tex/generic/circuitikz/pgfcircbipoles.tex | 577 ++++++++++++++------- .../tex/generic/circuitikz/pgfcircmultipoles.tex | 10 +- .../tex/generic/circuitikz/pgfcircquadpoles.tex | 80 +++ .../tex/generic/circuitikz/pgfcirctripoles.tex | 294 ++++++----- .../tex/generic/circuitikz/pgfcircutils.tex | 31 ++ .../texmf-dist/tex/latex/circuitikz/circuitikz.sty | 4 +- 9 files changed, 696 insertions(+), 307 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex index 82fde840f3c..a84fd4d95df 100644 --- a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex +++ b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex @@ -10,8 +10,8 @@ % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. -\def\pgfcircversion{1.3.4} -\def\pgfcircversiondate{2021/04/20} +\def\pgfcircversion{1.3.5} +\def\pgfcircversiondate{2021/05/02} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex index b35cb69166e..c4ce332209a 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex @@ -27,6 +27,7 @@ inductors/thickness=none, diodes/scale=1.0, diodes/fill=none, diodes/thickness=none, +thyristor style/.try=legacy, % % Batteries batteries/scale=1.0, diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex index 15e3e1e9cf1..6227a23d32b 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex @@ -22,6 +22,7 @@ inductors/thickness=1.0, % Diodes diodes/scale=0.6, diodes/thickness=1.0, +thyristor style/.try=compact, % % Batteries batteries/scale=1.0, @@ -53,6 +54,7 @@ amplifiers/scale=1.0, amplifiers/thickness=3.0, % % Logic ports +logic ports/.try=ieee, logic ports/scale=1.0, logic ports/thickness=2.0, logic ports origin=center, diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index 445a14d639d..b29aea51355 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -22,6 +22,7 @@ \pgf@circ@declare@family@arrows{tunable} \pgf@circ@declare@family@arrows{wiper} \pgf@circ@declare@family@arrows{switch} +\pgf@circ@declare@family@arrows{gto gate} %>>> @@ -1595,6 +1596,8 @@ \ctikzset{bipoles/esource/width/.initial=.60} \ctikzset{bipoles/pvsource/height/.initial=.60} \ctikzset{bipoles/pvsource/width/.initial=.60} +\ctikzset{bipoles/pvmodule/height/.initial=.60} +\ctikzset{bipoles/pvmodule/width/.initial=1.20} \ctikzset{bipoles/isource/height/.initial=.60} \ctikzset{bipoles/isource/width/.initial=.60} \ctikzset{bipoles/oosource/height/.initial=.60} @@ -1916,7 +1919,6 @@ \endpgfscope } - %% PV Source \pgfcircdeclarebipolescaled{sources} {} @@ -1958,6 +1960,35 @@ } +%% PV Module - contributed by Andre Alves +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/pvmodule/height}} +{pvmodule} +{\ctikzvalof{bipoles/pvmodule/height}} +{\ctikzvalof{bipoles/pvmodule/width}} +{ + + % Draw rectangle + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + + % Draw triangle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + + \pgfusepath{draw} +} + %% Empty Source \pgfcircdeclarebipolescaled{sources} {} @@ -2867,6 +2898,10 @@ \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@simple@opt{v}{pvmodule}{% + \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} @@ -2987,17 +3022,55 @@ \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/thyristor/gate height/.initial=0.0} % legacy 0 +\ctikzset{tripoles/thyristor/gate kink/.initial=1.0} % legacy 1.0 +\ctikzset{tripoles/thyristor/gto space up/.initial=0.5} % legacy 0.5 +\ctikzset{tripoles/thyristor/gto space down/.initial=0.0} % legacy 0.0 +\ctikzset{tripoles/thyristor/gto bar width/.initial=0.2} % legacy 0.2 \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} +\ctikzset{tripoles/triac/gate kink/.initial=1} + +\ctikzset{thyristor style/.is choice} +\ctikzset{thyristor style/legacy/.code={% + \ctikzset{tripoles/thyristor/height=1.1}% + \ctikzset{tripoles/thyristor/height 2=.5}% + \ctikzset{tripoles/thyristor/width=1.0}% + \ctikzset{tripoles/thyristor/diode height=.5}% + \ctikzset{tripoles/thyristor/diode width left=.4}% + \ctikzset{tripoles/thyristor/diode width right=.3}% + \ctikzset{tripoles/thyristor/gate height=0.0}% + \ctikzset{tripoles/thyristor/gate kink=1.0}% + \ctikzset{tripoles/thyristor/gto space up=0.5}% + \ctikzset{tripoles/thyristor/gto space down=0.0}% + \ctikzset{tripoles/thyristor/gto bar width=0.2}% + \ctikzset{tripoles/triac/gate kink=1}% +}} +\ctikzset{thyristor style/compact/.code={% + \ctikzset{tripoles/thyristor/height=0.8}% legacy 1.1 + \ctikzset{tripoles/thyristor/height 2=.5}% + \ctikzset{tripoles/thyristor/width=1.0}% + \ctikzset{tripoles/thyristor/diode height=.5}% + \ctikzset{tripoles/thyristor/diode width left=.4}% + \ctikzset{tripoles/thyristor/diode width right=.4}%legacy 0.3 + \ctikzset{tripoles/thyristor/gate height=0.5}% legacy 0 + \ctikzset{tripoles/thyristor/gate kink=0.7}% legacy 1.0 + \ctikzset{tripoles/thyristor/gto space up=0.25}% legacy 0.5 + \ctikzset{tripoles/thyristor/gto space down=0.25}% legacy 0.0 + \ctikzset{tripoles/thyristor/gto bar width=0.2}% + \ctikzset{tripoles/triac/gate kink=.7}% +}} + % % Flipping arrows in LED and photodiodes % @@ -3563,211 +3636,278 @@ \pgfusepath{draw} } -%% Black thyristor -\pgfcircdeclarebipolescaled{diodes} -{ - \anchor{gate}{\northeast} - \anchor{anode}{\southwest\pgf@y=0cm} - \anchor{G}{\northeast} - \anchor{cathode}{\northeast\pgf@y=0cm } -} -{\ctikzvalof{tripoles/thyristor/height 2}} -{fullthyristor} -{\ctikzvalof{tripoles/thyristor/height}} -{\ctikzvalof{tripoles/thyristor/width}} -{ - - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} +%%% Thyristors in general - \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - \pgfscope - \pgftransformxshift{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfusepath{draw,fill} - - \pgfsetlinewidth{\pgfstartlinewidth} +\def\pgfcircdeclarethyristor#1#2#3#4{%name, fill (0-> black; 1-empty), gate position (1: catode, -1: anode), extra code + \pgfcircdeclarebipolescaled{diodes} + { + \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/thyristor/gate kink}}} + \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x} + \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{cathode}{\northeast\pgf@y=0cm } + } + {\ctikzvalof{tripoles/thyristor/height 2}} + {#1} + {\ctikzvalof{tripoles/thyristor/height}} + {\ctikzvalof{tripoles/thyristor/width}} + { + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope + \pgfscope + % draw the thick parts here (shifted horizontally) + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + % draw the basic triangle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathclose + \ifnum#2=0\relax + \pgfusepath{draw,fill} + \else + \pgf@circ@draworfill + \fi + % draw the vertical bar + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + % back to normal linewidth + % stroke if needed + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi - \pgfusepath{draw} + % draw the gate thing; + #4 - \pgfsetlinewidth{\pgfstartlinewidth} + % draw the leads in/out + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + } +} +\def\pgfcirc@thyristor@simplegate{% + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@step} + {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\pgf@circ@res@up} + } \pgfusepath{draw} - } +%% Black thyristor +\pgfcircdeclarethyristor{fullthyristor}{0}{1}{\pgfcirc@thyristor@simplegate} %% Empty thyristor - -\pgfcircdeclarebipolescaled{diodes} -{ - \anchor{gate}{\northeast} - \anchor{anode}{\southwest\pgf@y=0cm} - \anchor{G}{\northeast} - \anchor{cathode}{\northeast\pgf@y=0cm } -} -{\ctikzvalof{tripoles/thyristor/height 2}} -{emptythyristor} -{\ctikzvalof{tripoles/thyristor/height}} -{\ctikzvalof{tripoles/thyristor/width}} -{ - - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - - \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - +\pgfcircdeclarethyristor{emptythyristor}{1}{1}{\pgfcirc@thyristor@simplegate} +%% black and empty GTO (standard: double line symbol, no arrow) + +\def\pgfcirc@doublegate@gto@add{ + % connection to gate terminal + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up - + \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\pgf@circ@res@up} + } + \pgfusepath{draw} \pgfscope - \pgftransformxshift{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathclose - \pgf@circ@draworfill - \pgfscope - % to allow filling, we need to draw explicitily the stroke here. - \pgfsetlinewidth{\pgfstartlinewidth} - \ifpgf@circuit@bipole@strokedsymbol - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{0pt}} - \pgfusepath{draw} - \fi - \endpgfscope - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} - + \pgfcirc@set@arrows{gto gate}{}{} + % \pgfsetarrowsstart{latexslim} + % first (lower) gto line: from body to gate + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@step} + {(\ctikzvalof{tripoles/thyristor/gate height}-\ctikzvalof{tripoles/thyristor/gto space down}) + *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up - + \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - + % second (higher) gto line: from gate to body + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up + + \ctikzvalof{tripoles/thyristor/gto space up}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\pgf@circ@res@step} + {(\ctikzvalof{tripoles/thyristor/gate height}+\ctikzvalof{tripoles/thyristor/gto space up}) + *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } \pgfusepath{draw} + \endpgfscope } +\pgfcircdeclarethyristor{fullgto}{0}{1}{\pgfcirc@doublegate@gto@add} +\pgfcircdeclarethyristor{emptygto}{1}{1}{\pgfcirc@doublegate@gto@add} -%% Empty triac -\pgfcircdeclarebipolescaled{diodes} -{ - \anchor{gate}{\northeast} - \anchor{anode}{\southwest\pgf@y=0cm} - \anchor{G}{\northeast} - \anchor{cathode}{\northeast\pgf@y=0cm } +\def\pgfcirc@bargate@gto@add{% + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@step} + {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\pgf@circ@res@up} + } + % draw bar line. + \pgfpathmoveto{\pgfpoint + {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right} + {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right} + {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up} + } + \pgfusepath{draw} } -{\ctikzvalof{tripoles/triac/height}} -{emptytriac} -{\ctikzvalof{tripoles/triac/height}} -{\ctikzvalof{tripoles/triac/width}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} +\pgfcircdeclarethyristor{fullgtobar}{0}{1}{\pgfcirc@bargate@gto@add} +\pgfcircdeclarethyristor{emptygtobar}{1}{1}{\pgfcirc@bargate@gto@add} - \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right +%% Thyristors with anode-connected gate - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} +\def\pgfcirc@thyristor@anodegate{% + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@other} + {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left} + {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left} + {\pgf@circ@res@up} + } + \pgfusepath{draw} +} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} +%% Black PUT +\pgfcircdeclarethyristor{fullput}{0}{-1}{\pgfcirc@thyristor@anodegate} +%% Empty PUT +\pgfcircdeclarethyristor{emptyput}{1}{-1}{\pgfcirc@thyristor@anodegate} +%% black and empty GTO (standard: double line symbol, no arrow) - \pgf@circ@draworfill +\def\pgfcirc@anodebargate@gto@add{% + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@other} + {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left} + {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left} + {\pgf@circ@res@up} + } + % draw bar line. + \pgfpathmoveto{\pgfpoint + {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left} + {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left} + {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up} + } + \pgfusepath{draw} +} - \pgfsetlinewidth{\pgfstartlinewidth} +\pgfcircdeclarethyristor{fullagtobar}{0}{-1}{\pgfcirc@anodebargate@gto@add} +\pgfcircdeclarethyristor{emptyagtobar}{1}{-1}{\pgfcirc@anodebargate@gto@add} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) +% Triacs - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} +\def\pgfcircdeclaretriac#1#2{%name, fill (0-> black; 1-empty) + \pgfcircdeclarebipolescaled{diodes} + { + \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/triac/gate kink}}} + \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x} + \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{cathode}{\northeast\pgf@y=0cm } + } + {\ctikzvalof{tripoles/triac/height}} + {#1} + {\ctikzvalof{tripoles/triac/height}} + {\ctikzvalof{tripoles/triac/width}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right - \pgfusepath{draw} -} + % diodes forms + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} -%% Full triac -\pgfcircdeclarebipolescaled{diodes} -{ - \anchor{gate}{\northeast} - \anchor{anode}{\southwest\pgf@y=0cm} - \anchor{G}{\northeast} - \anchor{cathode}{\northeast\pgf@y=0cm } -} -{\ctikzvalof{tripoles/triac/height}} -{fulltriac} -{\ctikzvalof{tripoles/triac/height}} -{\ctikzvalof{tripoles/triac/width}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + \ifnum#2=0\relax + \pgfusepath{draw,fill} + \else + \pgf@circ@draworfill + \fi - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + % draw gate + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right} + {-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) - \pgfusepath{draw,fill} + % draw leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + } +} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} +\pgfcircdeclaretriac{fulltriac}{0} +\pgfcircdeclaretriac{emptytriac}{1} - \pgfusepath{draw} -}% %>>> +% end of shape definitions for diodes%>>> %% Paths definitions for Diodes%<<< @@ -3792,6 +3932,14 @@ \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}{#1put}{#1put}{#1 put} + \pgfcirc@style@to@style{#1 put}{PUT#2} + \pgfcirc@activate@bipole{l}{#1gto}{#1gto}{#1 gto} + \pgfcirc@style@to@style{#1 gto}{GTO#2} + \pgfcirc@activate@bipole{l}{#1gtobar}{#1gtobar}{#1 gtobar} + \pgfcirc@style@to@style{#1 gtobar}{GTOb#2} + \pgfcirc@activate@bipole{l}{#1agtobar}{#1agtobar}{#1 agtobar} + \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2} \pgfcirc@activate@bipole{l}{#1triac}{#1triac}{#1 triac} \pgfcirc@style@to@style{#1 triac}{Tr#2} } @@ -3818,6 +3966,14 @@ \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}{emptyput}{#1 put}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 put}{PUT#2} + \pgfcirc@node@to@style{l}{emptygto}{#1 gto}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 gto}{GTO#2} + \pgfcirc@node@to@style{l}{emptygtobar}{#1 gtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 gtobar}{GTOb#2} + \pgfcirc@node@to@style{l}{emptyagtobar}{#1 agtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2} \pgfcirc@node@to@style{l}{emptytriac}{#1 triac}{\circuitikzbasekey/bipole/is strokedsymbol=true} \pgfcirc@style@to@style{#1 triac}{Tr#2} } @@ -3844,6 +4000,14 @@ \pgfcirc@style@to@style{bidirectionaldiode}{biD} \pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor} \pgfcirc@style@to@style{thyristor}{Ty} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro put}{put} +\pgfcirc@style@to@style{put}{PUT} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro gto}{gto} +\pgfcirc@style@to@style{gto}{GTO} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro gtobar}{gtobar} +\pgfcirc@style@to@style{gtobar}{GTOb} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro agtobar}{agtobar} +\pgfcirc@style@to@style{agtobar}{aGTOb} \pgfcirc@style@to@style{\pgfcircdiodestylemacro triac}{triac} \pgfcirc@style@to@style{triac}{Tr} % %>>> @@ -4657,6 +4821,62 @@ } % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 +% +% oscilloscope waveforms + +\ctikzset{% + bipoles/oscope/waveform/sin/.code={% + \pgfpathmoveto{\pgfpoint{-0.6cm}{0cm}} + \pgfpathsine{\pgfpoint{0.3cm}{0.4cm}} + \pgfpathcosine{\pgfpoint{0.3cm}{-0.4cm}} + \pgfpathsine{\pgfpoint{0.3cm}{-0.4cm}} + \pgfpathcosine{\pgfpoint{0.3cm}{0.4cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/ramps/.code={% + \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{-0.05cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{-0.05cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.65cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0.65cm}{-0.25cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/square/.code={% + \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{-0.6cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.6cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0.75cm}{0.25cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/triangle/.code={% + \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}} + \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{-0.3cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.3cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.75cm}{0cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/zero/.code={ + \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}} + \pgfpathlineto{\pgfpoint{0.75cm}{0cm}} + \pgfusepath{draw} + },% + bipoles/oscope/waveform/lissajous/.code={% + \pgfpathellipse{\pgfpoint{0cm}{0cm}} + {\pgfpoint{0.5cm}{0.35cm}}{\pgfpoint{-0.3cm}{0.2cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/none/.code={},% +} +% default waveform (backward compatible) +\ctikzset{bipoles/oscope/waveform/.initial=ramps} + \pgfcircdeclarebipolescaled{instruments} { \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} @@ -4682,8 +4902,6 @@ \pgfscope \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - % this would create a round (analog?) scope... - % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill \endpgfscope % get the rotation @@ -4700,23 +4918,24 @@ \pgfscope \pgfsetlinewidth{0.5\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} - \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]% + % the "almost one" make the grid complete most of the time --- beware of antialiasing + \pgfpathgrid[stepx=0.995\pgf@circ@res@step, stepy=0.995\pgf@circ@res@step]% {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}} {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}} \pgfsetstrokeopacity{0.5} \pgfusepath{draw} \endpgfscope - % function displayed, thanks to - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}} - \pgfusepath{draw} + % function displayed + \pgfscope + \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm} + \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm} + \pgftransformxscale{\@@scalex} + \pgftransformyscale{\@@scaley} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfkeys{\circuitikzbasekey/bipoles/oscope/waveform/\ctikzvalof{bipoles/oscope/waveform}} + \endpgfscope \endpgfscope } - % generic round meter with always horizontal text, no arrow \pgfcircdeclarebipolescaled{instruments} {} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex index 6acaa06aa99..23e0d40b7fb 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex @@ -687,11 +687,15 @@ \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))} \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)} } + % + % Notice that the "in" anchors must mimic "ext center", otherwise they are + % wrong for angles > 90 degrees! + % % center anchors - \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius} + \anchor{cin}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width} % horizontal angles - \anchor{in}{ \northwest \pgf@y=0pt} - \anchor{ain}{ \northwest \pgf@y=0pt} + \anchor{in}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius} + \anchor{ain}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius} \anchor{center}{ \central \pgf@y=0pt } \anchor{east}{ \northeast \pgf@y=0pt } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex index 7b267095403..1b2e77e613a 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex @@ -470,6 +470,7 @@ % powerelectronic blocks \ctikzset{bipoles/sacdc/width/.initial=.7} \ctikzset{bipoles/sdcac/width/.initial=.7} +\ctikzset{bipoles/sdcdc/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? @@ -1950,6 +1951,84 @@ } +%% dc/dc 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/sdcdc/width}} +{sdcdc} +{\ctikzvalof{bipoles/sdcdc/width}} +{\ctikzvalof{bipoles/sdcdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sdcdc/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 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} + + % 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} @@ -2270,6 +2349,7 @@ \pgfcirc@activate@bipole@simple{l}{detector} \pgfcirc@activate@bipole@simple{l}{sacdc} \pgfcirc@activate@bipole@simple{l}{sdcac} +\pgfcirc@activate@bipole@simple{l}{sdcdc} \pgfcirc@activate@bipole@simple{l}{tacdc} \pgfcirc@activate@bipole@simple{l}{tdcac} % %>>> diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index e013c51c3b3..cccb975f22b 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex @@ -3231,7 +3231,9 @@ \ctikzset{tripoles/njfet/gate height 2/.initial=.35} \ctikzset{tripoles/njfet/gate width/.initial=.5} \ctikzset{tripoles/njfet/base width/.initial=.5} -\ctikzset{tripoles/njfet/conn height/.initial=.35} +\ctikzset{tripoles/njfet/conn height/.initial=.35}% at the exterior +\ctikzset{tripoles/njfet/union height/.initial=.35}% at the gate +\ctikzset{tripoles/njfet/conn kink/.initial=1}% 1=no kink \ctikzset{tripoles/njfet/height/.initial=1.1} \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} @@ -3244,12 +3246,42 @@ \ctikzset{tripoles/pjfet/gate width/.initial=.5} \ctikzset{tripoles/pjfet/base width/.initial=.5} \ctikzset{tripoles/pjfet/conn height/.initial=.35} +\ctikzset{tripoles/pjfet/union height/.initial=.35}% at the gate +\ctikzset{tripoles/pjfet/conn kink/.initial=1}% 1=no kink \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/nujt/width/.initial=.7} +\ctikzset{tripoles/nujt/gate height/.initial=.5} +\ctikzset{tripoles/nujt/gate height 2/.initial=.35} +\ctikzset{tripoles/nujt/gate width/.initial=.5} +\ctikzset{tripoles/nujt/base width/.initial=.5} +\ctikzset{tripoles/nujt/conn height/.initial=.35} +\ctikzset{tripoles/nujt/union height/.initial=0}% at the gate +\ctikzset{tripoles/nujt/conn kink/.initial=.82}% to match the circle position +\ctikzset{tripoles/nujt/height/.initial=1.1} +\ctikzset{tripoles/nujt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nujt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nujt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nujt/curr direction/.initial=1} + +\ctikzset{tripoles/pujt/width/.initial=.7} +\ctikzset{tripoles/pujt/gate height/.initial=.5} +\ctikzset{tripoles/pujt/gate height 2/.initial=.35} +\ctikzset{tripoles/pujt/gate width/.initial=.5} +\ctikzset{tripoles/pujt/base width/.initial=.5} +\ctikzset{tripoles/pujt/conn height/.initial=.35} +\ctikzset{tripoles/pujt/union height/.initial=0}% at the gate +\ctikzset{tripoles/pujt/conn kink/.initial=.82}% to match the circle position +\ctikzset{tripoles/pujt/height/.initial=1.1} +\ctikzset{tripoles/pujt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pujt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pujt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pujt/curr direction/.initial=-1} + \ctikzset{tripoles/isfet/width/.initial=1} \ctikzset{tripoles/isfet/gate height/.initial=.35} \ctikzset{tripoles/isfet/base height/.initial=.5} @@ -5417,139 +5449,159 @@ \fi } -\pgfcircdeclaretransistor{njfet}{ - \anchor{inner up}{ - \northeast - \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y - } - \anchor{inner down}{ - \northeast - \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y - } - }{% - % add the circle if requested (before everything else, so we can fill it) - \pgfcirc@transistorcircle - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} +%%% uni-junction transistors: jfets, ujts - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfusepath{draw} +\long\def\pgfcircdeclarejunctiontransistor#1#2#3{% name, extra anchors, extra draw + \pgfcircdeclaretransistor{#1}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y + } + \anchor{kink}{ + \northeast + \pgf@ya=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y + \left + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya + \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x + } + % extra anchors (or override) + #2 + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle - \pgfscope - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}} + % get direction + \edef\@@dir{\ctikzvalof{tripoles/#1/curr direction}} + + % draw drain/source connections: up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}} - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} + + % down + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} - \endpgfscope - % arrow - \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgfresetnontranslationattimefalse - \ifpgf@circuit@trans@arrowatend - \edef\@@anchor{tip}\edef\@@pos{1.0} - \else - \edef\@@anchor{center}\edef\@@pos{0.6} - \fi - \pgftransformlineattime{\@@pos}{% - \pgfpoint{\pgf@circ@res@left}% - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% - }{% - \pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}% - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% - } - \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} - \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} - \pgfusepath{draw} -} + % arrow + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \ifnum\@@dir>0 + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{btip}\edef\@@pos{1.0} + \fi + \else + \ifnum\@@dir>0 + \edef\@@anchor{center}\edef\@@pos{0.6} + \else + \edef\@@anchor{center}\edef\@@pos{0.4} + \fi + \fi + % find x1, x2 and y for the base arrow + \ifnum\@@dir>0 + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left + \pgf@circ@res@other=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left + \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@down + \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down + \else + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left + \pgf@circ@res@other=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left + \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up + \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@up + \fi + % + % gate line (called emitter in UJT) + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + % + % horizontal gate line + % + \ifpgf@circuit@bpt@drawgate + \ifnum\@@dir>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \fi + \fi + \pgfusepath{draw} + % + % gate arrows (called emitter in UJT) + % + \pgftransformlineattime{\@@pos}{% + \pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp} + }{% + \pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero} + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + % + % gate line (called emitter in UJT) + % + \endpgfscope -\pgfcircdeclaretransistor{pjfet}{ - \anchor{inner up}{ - \northeast - \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y - } - \anchor{inner down}{ - \northeast - \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y - } - }{% - % add the circle if requested (before everything else, so we can fill it) - \pgfcirc@transistorcircle - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + % extra drawings + #3 + } +} - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfusepath{draw} +% NJFET and PJFET - \pgfscope - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}} - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfusepath{draw} - \endpgfscope +\pgfcircdeclarejunctiontransistor{njfet}{}{} +\pgfcircdeclarejunctiontransistor{pjfet}{}{} - \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgfresetnontranslationattimefalse - \ifpgf@circuit@trans@arrowatend - \edef\@@anchor{btip}\edef\@@pos{1.0} - \else - \edef\@@anchor{center}\edef\@@pos{0.4} +\def\@ujtanchoroverride#1{ + \savedanchor{\ujtrealemitter}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y %north anchor height + % kink AND conn height, they're the same + \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + % horizontal + \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen % left + \ifpgf@circuit@bpt@drawgate\else + \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x \fi - \pgftransformlineattime{\@@pos}{% - \pgfpoint% - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}% - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% - }{% - \pgfpoint{\pgf@circ@res@left}% - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% - } - \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} - \endpgfscope - - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} - \pgfusepath{draw} + } + \anchor{E}{\ujtrealemitter} + \anchor{emitter}{\ujtrealemitter} + \anchor{B2}{\northeast\pgf@y=-\pgf@y} + \anchor{B1}{\northeast} } + +\pgfcircdeclarejunctiontransistor{nujt}{\@ujtanchoroverride{nujt}}{} +\pgfcircdeclarejunctiontransistor{pujt}{\@ujtanchoroverride{pujt}}{} + + \pgfdeclaretransistorwrapperaddbulk{isfet}{ }{% % add the circle if requested (before everything else, so we can fill it) diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex index 9400b0c7011..ac87e083040 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex @@ -89,4 +89,35 @@ }}}% } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% subcircuits (experimental) +%% +%% introduced by Romano Giannetti around April 2021 +%% +%% +\newbox\ctikz@scratchbox +\long\def\ctikzsubcircuitdef#1#2#3{% + \expandafter\gdef\csname #1@Anchor\endcsname{} + \expandafter\gdef\csname #1@setanchors\endcsname{ + \setbox\ctikz@scratchbox=\hbox{% + \begin{circuitikz} + \draw (0,0) \csname#1\endcsname{T-#1}{}; + \foreach [count=\i] \anchor in {#2} + % reference anchor is -center + \draw (0,{2-\i/2}) let \p1 = ($(T-#1-subckt@reference)-(T-#1-\anchor)$) in + node[right]{\anchor: \x1,\y1 \expandafter\xdef\csname #1@Anchor\anchor\endcsname{++(\x1,\y1)}}; + \end{circuitikz} + } + } + \expandafter\gdef\csname#1\endcsname##1##2{\csname#1aux\endcsname{##1}{\csname #1@Anchor##2\endcsname}} + \expandafter\gdef\csname#1aux\endcsname##1##2{% + % move to the anchor + ##2 + % reference anchor should be -reference + coordinate (##1-subckt@reference) + #3 + } +} +\long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname} + \endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty index 95631c84b4d..bcf532bfe6f 100644 --- a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty +++ b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty @@ -12,8 +12,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{1.3.4} -\def\pgfcircversiondate{2021/04/20} +\def\pgfcircversion{1.3.5} +\def\pgfcircversiondate{2021/05/02} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] -- cgit v1.2.3