Debian Codegraph @

texmf-dist/doc/latex/tikzquads/tikzquads.tex

raw
1 %%%==============================================================================
2 % WinEdt pragmas
3 % !Mode:: "TeX:EN"
4 % Default Compile engines:
5 % !TEX program = pdflatex
6 % !PDFTeXify ext = --enable-etex --restrict-write18
7 % !PDFLaTeX ext = --enable-etex --restrict-write18
8 % !BIB program = biber
9 %%%==============================================================================
10 %% Copyright 2024-present by Alceu Frigeri
11 %%
12 %% This work may be distributed and/or modified under the conditions of
13 %%
14 %% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
15 %% version 1.3c (or later), and/or
16 %% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
17 %% version 3 (or later)
18 %%
19 %% This work has the LPPL maintenance status *maintained*.
20 %%
21 %% The Current Maintainer of this work is Alceu Frigeri
22 %%
23 %% This is version {1.2a} {2025/11/10}
24 %%
25 %% The list of files that compose this work can be found in the README.md file at
26 %% https://ctan.org/pkg/tikzdotncross
27 %%
28 %%%==============================================================================
29 \documentclass[10pt]{article}
30 \RequirePackage[verbose,a4paper,marginparwidth=27.5mm,top=2.5cm,bottom=1.5cm,hmargin={40mm,20mm},marginparsep=2.5mm,columnsep=10mm,asymmetric]{geometry}
31 \usepackage[T1]{fontenc}
32 \usepackage[utf8]{inputenc}
33 \usepackage{lmodern}
34 \usepackage[base skip=6pt,infograb]{codedescribe}
35 \RequirePackage[inline]{enumitem}
36 \SetEnumitemKey{miditemsep}{parsep=0ex,itemsep=0.4ex}
37
38 \RequirePackage[backend=biber]{biblatex}
39 \addbibresource{tikzquads.bib}
40
41 \usepackage[american,siunitx,cuteinductors,smartlabels,arrowmos,EFvoltages,betterproportions]{circuitikz}
42 \usetikzlibrary{math}
43 \usepackage{tikzquads}
44
45
46 \RequirePackage{amsmath}
47 \RequirePackage{amsthm, amssymb, amsfonts}
48 %\RequirePackage{mathrsfs}
49 %\RequirePackage{mathtools}
50 %\RequirePackage{empheq}
51 %\RequirePackage{cases}
52 %\RequirePackage{extarrows}
53 %\RequirePackage{mathfixs}
54
55 \RequirePackage[hidelinks,hypertexnames=false]{hyperref}
56
57
58 \NewDocumentCommand{\pincoordinates}{m}{ \path \foreach \n/\a/\d in {#1} { (\n) \pincoord(\n,blue,\a,\d)}; }
59
60 \NewDocumentCommand{\pinanchors}{mm}{ \path \foreach \n/\a/\d in {#2} { (#1.\n) \pincoord(\n,blue,\a,\d)}; }
61 \NewDocumentCommand{\pingeoanchors}{m}{ \pinanchors{#1}{%
62 north/90/4, north east/55/4, east/0/4,%
63 south east/-55/4,%
64 south/-90/4, south west/-100/4, west/180/4, north west/100/4,%
65 center/-165/17}
66 }
67
68
69 \NewDocumentCommand{\pinquadanchors}{m}{%
70 \pinanchors{#1}{%
71 1+/135/4, 1-/225/4, 2+/45/4, 2-/-45/4, inner 1+/-45/2, inner 1-/45/2, inner 2+/225/2, inner 2-/135/2
72 }
73 }
74
75 \NewDocumentCommand{\pinblackboxanchors}{m}{%
76 \pinanchors{#1}{%
77 1+/135/4, 1-/225/4, inner 1+/-45/2, inner 1-/45/2
78 }
79 }
80
81 \NewDocumentCommand{\pinquadtextanchors}{m}{%
82 \pinanchors{#1}{%
83 bottom left/225/4, bottom center/-90/4, bottom right/-45/4,
84 inner bottom left/225/4, inner bottom center/90/2, inner bottom right/-45/4,
85 top left/135/4, top center/90/4, top right/45/4,
86 inner top left/135/4, inner top center/-90/2, inner top right/45/4
87 }
88 }
89
90
91 \setnewcodekey{tikzquads keys}
92 {
93 codeprefix={},
94 resultprefix={},
95 emph={draw,node,coord},
96 emph2={x,y,axis,fit,to,outer,inner,round,control,sources,european,alt},
97 emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton,PG,linear,load,line,QuadParConnect},
98 numbers=left
99 }
100
101
102 \begin{document}
103 \tstitle{
104 author={Alceu Frigeri\footnote{\tsverb{https://github.com/alceu-frigeri/tikzquads}}},
105 date={\tsdate},
106 title={The tikzquads Package\break An Extension to CircuiTi\emph{k}Z\break Version \PkgInfo{tikzquads}{version}}
107 }
108
109
110 \begin{typesetabstract}
111
112 This package defines a few extra shapes (single / dual port boxes) designed to be used together with the \tsobj[pkg]{CircuiTikZ}\cite{circuitikz} package.
113 \end{typesetabstract}
114 \tableofcontents
115
116 \section{Introduction}
117 In standard text books, Circuit Theory and Electronics alike, quite often one ends representing sub-circuits as either:
118 \begin{itemize}
119 \item a single port \emph{black box}, or
120 \item a dual port \emph{black box}
121 \end{itemize}
122
123 This package defines a few, parameterized shapes for each case:
124 \begin{itemize}
125 \item for single port \emph{black boxes}:
126 \begin{itemize}
127 \item Black Box
128 \item Thevenin
129 \item Norton
130 \end{itemize}
131 \item for dual port \emph{black boxes}:
132 \begin{itemize}
133 \item Quad
134 \item Quad Z
135 \item Quad Y
136 \item Quad G
137 \item Quad H
138 \end{itemize}
139 \end{itemize}
140 A \emph{Pseudo-Graph load line} shape is also defined, for those moments where a true graph, like the ones \tsobj[pkg]{pgfplots}\cite{PGFPLOTS:1.18} or \tsobj[pkg]{tikzfxgraph}\cite{tikzfxgraph} enables, isn't needed.
141 Lastly, a convenience interconnection command is defined, \tsobj{\QuadParConnect} (see \ref{Parallel Conn}).
142
143 \subsection{CircuiTi\emph{k}Z}
144 Unfortunately, some implementation details of this package don't follow the code structure adopted by \tsobj[pkg]{CircuiTikZ}\cite{circuitikz}, and some significant part of this package's code would have to be re-written if it were to be integrated directly in \tsobj[pkg]{CircuiTikZ}, and that's the main reason this is, for the time being, a separate package. After all, even though this doesn't follows \tsobj[pkg]{CircuiTikZ} code scheme, it does work nicely with it, as is.
145
146 \subsection{Package Requirements}
147 Internally, many commands relies on \tsobj[pkg]{pgfkeysearch}\cite{pgfkeysearch} which is loaded with default options. If needed, the user is advised to use the commands \tsobj[code,sep=or]{\pgfkeysearchsettings,\pgfkeysearch_settings:n} from \tsobj[pkg]{pgfkeysearch} instead of passing package options (to avoid a package options crash error). The same applies to package \tsobj[pkg]{tikzdotncross}\cite{tikzdotncross} needed for \tsobj{\QuadParConnect} (see \ref{Parallel Conn}), use the command \tsobj{\setpindefaults} to change (if needed) it's defaults.
148 Besides those packages, only \tsobj[pkg]{pkginfograb} is loaded (for package's info tracking).
149
150 So, the user is supposed to load \tsobj[pkg]{pgf/tikz}\cite{TIKZPGF:3.1} before this, with user preferred settings and, most likely, \tsobj[pkg]{CircuiTikZ}\cite{circuitikz}.
151
152 \begin{codestore}[reqmts]
153 \usepackage{tikz}
154 \usepackage{tikzquads}
155 \end{codestore}
156 \begin{codestore}[reqmts]
157 \usepackage[american,siunitx]{circuitikz}
158 \usepackage{tikzquads}
159 \end{codestore}
160 \tscode*[tikzquads keys]{reqmts}[1]
161 \tscode*[tikzquads keys]{reqmts}[2]
162
163
164
165
166 \newpage
167 \section{Auxiliary Shapes and Basic Keys}
168 %Those shapes are not intended for end users.
169
170 \subsection{Auxiliary shapes}\label{auxiliarynodes}
171 A set of auxiliary shapes are defined, but not meant to be used otherwise, though their anchors might be relevant:
172
173 \begin{center}
174 \resizebox{0.8\textwidth}{!}{
175 \begin{tikzpicture}
176 \draw (0,0) node[QuadKeys,generic,H Res shape](N){};
177 \pingeoanchors{N}
178 \draw (4,0) node[QuadKeys,H Res shape](N){};
179 \pingeoanchors{N}
180 \draw (8,0) node[QuadKeys,generic,V Res shape](N){};
181 \pingeoanchors{N}
182 \draw (12,0) node[QuadKeys,V Res shape](N){};
183 \pingeoanchors{N}
184
185 \draw (0,-2) node[QuadKeys,round sources,IsourceDOWN shape](N){};
186 \pingeoanchors{N}
187 \draw (4,-2) node[QuadKeys,IsourceDOWN shape](N){};
188 \pingeoanchors{N}
189 \draw (8,-2) node[QuadKeys,round sources,IsourceUP shape](N){};
190 \pingeoanchors{N}
191 \draw (12,-2) node[QuadKeys,IsourceUP shape](N){};
192 \pingeoanchors{N}
193
194 \draw (0,-4) node[QuadKeys,round sources,Vsource shape](N){};
195 \pingeoanchors{N}
196 \draw (4,-4) node[QuadKeys,Vsource shape](N){};
197 \pingeoanchors{N}
198
199 \end{tikzpicture}}
200 \end{center}
201
202 \begin{tsremark}
203 The point being that, regardless of the sub-shape orientation, the intuitive geographical coordinates applies.
204 \end{tsremark}
205
206
207
208 \subsection{General Keys}\label{generalkeys}
209 General keys to fine tuning a shape:
210 \begin{describelist*}[30mm]{keys}
211 \describe {outer sep} {Text outer separation, initial value: 1.5pt}
212 \describe {inner sep} {Text inner separation, initial value: 1pt}
213 \describe {thickness} {Components thickness (relative to the drawing thickness), initial value: 2}
214 \describe {tip len} {tip len (current source). initial value: 4pt}
215 \describe {tip type} {possible values: \tsobj[keys]{triangle,bezier}. initial value: \tsobj[keys]{triangle}}
216 \describe {minussign len} {Minus sign len (voltage source). initial value: \tsobj{\pgf@circ@Rlen/14}}
217 \describe {plussign len} {Plus sign len (voltage source). initial value: \tsobj{1.1\pgf@circ@Rlen/14}}
218 \describe {source radius} {The base radius. initial value: \tsobj{0.3\pgf@circ@Rlen}}
219 \describe {round sources} {Sources will be round ones}
220 \describe {control sources} {Sources will be control/diamond ones}
221 \describe {generic, european} {Impedances will be generic rectangles}
222 \describe {zigzag, american} {Impedances will be draw as zigzags}
223 \end{describelist*}
224
225
226 % \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
227
228
229 \section{Z, Y, G, H Quadripoles}\label{quadanchors}
230 A set of configurable Quadripoles is defined, whereas quadripoles parameters (for instance $Z_{11}$, $Z_{12}$, $Z_{21}$ and $Z_{22}$) are \tsobj[marg]{key-value} parameters.
231 \subsection{The Base Dual Port / Quadripole Shape}
232 The base shape just draws a base box and sets some connection anchors: $1+$, $1-$, $inner\ 1+$, $inner\ 1-$, $2+$, $2-$, $inner\ 2+$ and $inner\ 2-$, besides the geographic ones:
233
234 %,label bottom left={T1},label bottom center={T2},label bottom right={T3}
235
236 \begin{center}%
237 \resizebox{0.8\textwidth}{!}{%
238 \begin{tikzpicture}
239 \draw (0,0) node[Quad](Qa){text};
240 \pingeoanchors{Qa}
241 \draw (Qa.2+) ++(2,0) node[Quad,anchor=1+](Qb){text};
242 \pinquadanchors{Qb}
243 \end{tikzpicture}
244 }
245 \end{center}
246
247 And also a set of (meant for) \emph{text} anchors:
248
249 \begin{center}
250 \resizebox{0.4\textwidth}{!}{
251 \begin{tikzpicture}
252 \draw (0,0) node[Quad](Qc){text};
253 \pinquadtextanchors{Qc}
254 \end{tikzpicture}
255 }
256 \end{center}
257
258
259
260 \subsubsection{Base Keys}\label{quadkeys}
261 These applies to all Quad shapes:
262 \begin{describelist*}[30mm]{keys}
263 \describe {base width} {The 'box' width}
264 \describe {half base width} {Ditto, half width. Initial value:\tsobj{2\pgf@circ@Rlen}.}
265 \describe {base height} {The distance between \tsobj[keys]{1+,1-}. The 'box' full height is equal to 2*(\tsobj[keys]{half base height} + \tsobj[keys]{height ext} + \tsobj[keys]{height ext+}).}
266 \describe {half base height} {Ditto, half height. Initial value:\tsobj{\pgf@circ@Rlen/7} }
267 \describe {height ext}{Initial value:\tsobj{2\pgf@circ@Rlen/7}}
268 \describe {height ext+}{Initial value:0}
269 \describe {inner ext} {distance between the 'box' and \tsobj{inner 1+/1-/2+/2-}. initial value: \tsobj{\pgf@circ@Rlen/7}}
270 \describe {outer ext} {distance between the 'box' and \tsobj{1+/1-/2+/2-}. initial value: \tsobj{5\pgf@circ@Rlen/14}}
271 \describe {inner marks} {If set, the inner anchors will be marked.}
272 \describe {outer marks} {If set, the outer anchors will be marked.}
273 \describe {invert} {The shape will be inverted, more or less like 'x scale=-1'.}
274 \describe {alt, opt} {Case a Voltage source is zero, a series impedance will be draw vertically.}
275 \describe {outer x fit to} {For any Quad, this is the same as \tsobj[key]{outer x fit to*}.}
276 \describe {outer x fit to*} {It takes 2 arguments: \tsobj[keys]{outer x fit*=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) \textbf{will fit} \tsobj[meta]{CoordA,CoordB}. This might result in a shape rotation.}
277 \describe {outer x fit to!} {It takes 2 arguments: \tsobj[keys]{outer x fit!=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that the distance between \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) will be the same as \tsobj[meta]{CoordA,CoordB}. This will never result in a shape rotation.}
278 \describe {inner x fit to} {For any Quad, this is the same as \tsobj[key]{inner x fit to*}.}
279 \describe {inner x fit to*} {It takes 2 arguments: \tsobj[keys]{inner x fit*=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) \textbf{will fit} \tsobj[meta]{CoordA,CoordB}. This might result in a shape rotation.}
280 \describe {inner x fit to!} {It takes 2 arguments: \tsobj[keys]{inner x fit!=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that the distance between \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) will be the same as \tsobj[meta]{CoordA,CoordB}. This will never result in a shape rotation.}
281 \describe {y fit to} {For any Quad, this is the same as \tsobj[key]{y fit to!}.}
282 \describe {y fit to*} {It takes 2 arguments: \tsobj[keys]{y fit*=}\tsargs[marg]{CoordA,CoordB}. The height will be set so that \tsobj[keys]{1+,1-} \textbf{will fit} \tsobj[keys]{CoordA,CoordB}. This might result in a shape rotation}
283 \describe {y fit to!} {It takes 2 arguments: \tsobj[keys]{y fit!=}\tsargs[marg]{CoordA,CoordB}. The height will be set so that the distance between \tsobj[meta]{1+,1-} will be equal to the distance between \tsobj[marg]{CoordA,CoordB}. This will never result in a shape rotation.}
284 %
285 % \describe {outer x fit to} {\tsobj[keys]{outer x fit=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) will fit \tsobj[meta]{CoordA,CoordB}}
286 % \describe {outer x fit to*} {Same as \tsobj[key]{outer x fit to}, might result in a rotation.}
287 % \describe {outer x fit to!} {Same as \tsobj[key]{outer x fit to}, but will never result in a rotation.}
288 % \describe {inner x fit to} {\tsobj[keys]{inner x fit=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) will fit \tsobj[meta]{CoordA,CoordB}}
289 % \describe {inner x fit to*} {Same as \tsobj[key]{inner x fit to}, might result in a rotation.}
290 % \describe {inner x fit to!} {Same as \tsobj[key]{inner x fit to}, but will never result in a rotation.}
291 % \describe {y fit to} {\tsobj[keys]{y fit=}\tsargs[marg]{CoordA,CoordB}. The distance between, lets say \tsobj[keys]{1+,1-} will be made equal to the distance between \tsobj[keys]{CoordA,CoordB}.}
292 % \describe {y fit to*} {Same as \tsobj[key]{y fit to}, might result in a rotation.}
293 % \describe {y fit to!} {Same as \tsobj[key]{y fit to}, but will never result in a rotation.}
294 \describe{label top left}{It will place a label at the top left anchor}
295 \describe{label top center}{It will place a label at the top center anchor}
296 \describe{label top right}{It will place a label at the top right anchor}
297 \describe{label inner top left}{It will place a label at the inner top left anchor}
298 \describe{label inner top center}{It will place a label at the inner top center anchor}
299 \describe{label inner top right}{It will place a label at the inner top right anchor}
300 \describe{label bottom left}{It will place a label at the bottom left anchor}
301 \describe{label bottom center}{It will place a label at the bottom center anchor}
302 \describe{label bottom right}{It will place a label at the bottom right anchor}
303 \describe{label inner bottom left}{It will place a label at the inner bottom left anchor}
304 \describe{label inner bottom center}{It will place a label at the inner bottom center anchor}
305 \describe{label inner bottom right}{It will place a label at the inner bottom right anchor}
306 \end{describelist*}
307 %\begin{tsremark}
308 %For Quadripoles, \tsobj[keys]{outer x fit, inner x fit} might result in a shape rotation. \tsobj[keys]{y fit} never will result in a rotation.
309 %\end{tsremark}
310 %\begin{tsremark}
311 %Those keys can be used with all the following components: \tsobj[meta]{Quad,Quad Z,Quad Y,Quad G,Quad H,ToQuad,ToQuad Z,ToQuad Y,ToQuad G,ToQuad H,Black Box,Thevenin,Norton,ToBlack Box,ToThevenin,ToNorton}.
312 %\end{tsremark}
313
314
315 A small example of the \emph{fit to} keys:
316 \begin{codestore}[QuadKeysA]
317 \begin{tikzpicture}
318 \draw (0,0) \pincoord(A,blue,225) ++(4,0) \pincoord(B,blue,-45) ++(2,2) \pincoord(C) ;
319
320 \draw (A) node[Quad,anchor=1+,outer x fit to={A}{B}](Qa){\footnotesize$Qa$};
321 \draw (B) node[Quad,anchor=1+,outer x fit to={B}{C},I1=$I_a$,V2=$V_b$](Qb){\footnotesize$Qb$};
322
323 \draw (Qb.2-) -- ++(2,0) \pincoord(D) ++(1,-2) \pincoord(E);
324
325 \draw (D) node[Black Box,anchor=1+,y fit to={D}{E}](Ba){\footnotesize$Ba$};
326
327 \draw (Qa.1-) ++(0,-1);
328 \end{tikzpicture}
329 \end{codestore}
330
331 \tsdemo*[tikzquads keys]{QuadKeysA}
332
333
334
335 % show anchors of a node component:
336 % optional: options of the circuitikz environment
337 % mandatory node spec, node text
338 % optional between (): anchor specification list
339 \NewDocumentCommand{\showsubanchors}{O{} m m m d()}
340 {
341 \begin{circuitikz}[#1]
342 \draw (0,0) node[#2](N){#3};
343 \IfValueT{#5}{%
344 \foreach \sn in {#4} {%
345 \foreach \n/\a/\d in {#5} {%
346 \path (N-\sn.\n) \showcoord(\n)<\a:\d>;
347 }
348 }
349 }
350 ;\par
351 \end{circuitikz}%
352 }
353
354 \subsection{Quad}
355 \begin{codestore}[QuadDef]
356 % Node use
357 node[Quad]{}
358
359 % To path use
360 (A) to[ToQuad] (B)
361 \end{codestore}
362
363 \tscode*[tikzquads keys]{QuadDef}
364
365 This is just the base shape, to be used in cases whereas one just want to emphasises part of a circuit (using, for instance, the \tsobj[key]{inner x fit to} key, or just mark a two port black box.
366 \begin{tsremark}
367 There is also a \tsobj[key]{ToQuad} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
368 \end{tsremark}
369
370 \begin{center}%
371 \resizebox{0.8\textwidth}{!}{%
372 \begin{tikzpicture}
373 \draw (0,0) node[Quad](Qa){text};
374 \pingeoanchors{Qa}
375 \draw (Qa.2+) ++(2,0) node[Quad,anchor=1+](Qb){text};
376 \pinquadanchors{Qb}
377
378 \draw (Qa.2-) ++(1,-1.5) node[Quad,anchor=north](Qc){text};
379 \pinquadtextanchors{Qc}
380 \end{tikzpicture}
381 }
382 \end{center}
383
384 \subsubsection{Quad Keys}
385 \begin{describelist*}{keys}
386 \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
387 \describe{I1}{Initial value:\tsverb{$I_1$}}
388 \describe{I2}{Initial value:\tsverb{$I_2$}}
389 \describe{V1}{Initial value:\tsverb{$V_1$}}
390 \describe{V2}{Initial value:\tsverb{$V_2$}}
391 \end{describelist*}
392
393
394 \subsubsection{Examples of \emph{fit to} use}
395 Squeezing a Quadripole between two parts of a circuit (nodes C and D):
396
397 \begin{codestore}[QuadfitA]
398 \begin{center}
399 \resizebox{0.5\textwidth}{!}{
400 \begin{tikzpicture}
401 \draw (0,0) \pincoord(ref) to[R=R1] ++(0,2) \pincoord(A) to[R=R2] ++(0,2) \pincoord(B)
402 -- ++(2,0) \pincoord(C,red,225) (C |- ref) \pincoord(C1,blue,135) -- (ref);
403 \draw (C) ++(7,0) \pincoord(D,red) -- ++(0.5,0) to[R=R3] ++(0,-3) -- ++(2,0) to[R=R4] ++(0,3) -- ++(0.5,0) \pincoord(E);
404 \draw (C) node[Quad,anchor=1+,y fit to={C}{C1},outer x fit to={C}{D}]{};
405 \end{tikzpicture}
406 }
407 \end{center}
408 \end{codestore}
409
410 \tsdemo*[tikzquads keys]{QuadfitA}
411
412 ~
413
414 Fitting some circuit inside the Quadripole (nodes C and E):
415 \begin{codestore}[QuadfitB]
416 \resizebox{0.4\textwidth}{!}{
417 \begin{tikzpicture}
418 \draw (0,0) \pincoord(ref) to[R=R1] ++(0,2) \pincoord(A) to[R=R2] ++(0,2) \pincoord(B)
419 -- ++(2,0) \pincoord(C,red) (C |- ref) \pincoord(C1) -- (ref);
420 \draw (C) ++(7,0) \pincoord(D) -- ++(0.5,0) to[R=R3] ++(0,-3) -- ++(2,0) to[R=R4] ++(0,3) -- ++(0.5,0) \pincoord(E,red);
421 \draw (C) node[Quad,anchor=inner 1+,y fit to={C}{C1},inner x fit to={C}{E}]{};
422 \end{tikzpicture}}
423 \end{codestore}
424
425 \tsdemo*[tikzquads keys]{QuadfitB}
426
427
428
429 \subsection{Quad Z}
430 \begin{codestore}[QuadZDef]
431 % Node use
432 node[Quad Z]{}
433
434 % To path use
435 (A) to[ToQuad Z] (B)
436 \end{codestore}
437
438 \tscode*[tikzquads keys]{QuadZDef}
439
440 Besides the base anchors (see \ref{quadanchors}) it has 4 internal nodes: \tsobj[key]{<node>-Z11,<node>-Z12,<node>-Z21,<node>-Z22} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
441 \begin{tsremark}
442 There is also a \tsobj[key]{ToQuad Z} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
443 \end{tsremark}
444
445 \begin{center}%
446 \resizebox{0.8\textwidth}{!}{%
447 \begin{tikzpicture}
448 \draw (0,0) node[Quad Z](Qa){text};
449 \pingeoanchors{Qa}
450 \draw (Qa.2+) ++(2,0) node[Quad Z,anchor=1+](Qb){text};
451 \pinquadanchors{Qb}
452 \end{tikzpicture}
453 }
454 \end{center}
455 \begin{center}%
456 \resizebox{0.4\textwidth}{!}{%
457 \begin{tikzpicture}
458 \draw (0,0) node[Quad Z,anchor=north](Qc){text};
459 \pinquadtextanchors{Qc}
460 \end{tikzpicture}
461 }
462 \end{center}
463
464 \subsubsection{Quad Z keys}
465 \begin{describelist*}[30mm]{keys}
466 \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
467 \describe{I1}{Initial value:\tsverb{$I_1$}}
468 \describe{I2}{Initial value:\tsverb{$I_2$}}
469 \describe{V1}{Initial value:\tsverb{$V_1$}}
470 \describe{V2}{Initial value:\tsverb{$V_2$}}
471 \describe {raw sources} {This will suppress the control variables (I1, I2) in the sources' labels}
472 \describe{Z11}{Initial value:\tsverb{$Z_{11}$}}
473 \describe{Z12}{Initial value:\tsverb{$Z_{12}$}}
474 \describe{Z21}{Initial value:\tsverb{$Z_{21}$}}
475 \describe{Z22}{Initial value:\tsverb{$Z_{22}$}}
476 \describe{Z11 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
477 \describe{Z12 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
478 \describe{Z21 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
479 \describe{Z22 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top right}}}
480 \end{describelist*}
481 \begin{tsremark}
482 The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
483 \end{tsremark}
484
485
486
487 \subsection{Quad Y}
488 \begin{codestore}[QuadYDef]
489 % Node use
490 node[Quad Y]{}
491
492 % To path use
493 (A) to[ToQuad Y] (B)
494 \end{codestore}
495
496 \tscode*[tikzquads keys]{QuadYDef}
497 Besides the base anchors (see \ref{quadanchors}) it has 4 internal nodes: \tsobj[key]{<node>-Y11,<node>-Y12,<node>-Y21,<node>-Y22} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
498 \begin{tsremark}
499 There is also a \tsobj[key]{ToQuad Y} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
500 \end{tsremark}
501
502 \begin{center}%
503 \resizebox{0.8\textwidth}{!}{%
504 \begin{tikzpicture}
505 \draw (0,0) node[Quad Y](Qa){text};
506 \pingeoanchors{Qa}
507 \draw (Qa.2+) ++(2,0) node[Quad Y,anchor=1+](Qb){text};
508 \pinquadanchors{Qb}
509 \end{tikzpicture}
510 }
511 \end{center}
512 \begin{center}%
513 \resizebox{0.4\textwidth}{!}{%
514 \begin{tikzpicture}
515 \draw (0,0) node[Quad Y,anchor=north](Qc){text};
516 \pinquadtextanchors{Qc}
517 \end{tikzpicture}
518 }
519 \end{center}
520
521 \subsubsection{Quad Y keys}
522 \begin{describelist*}[30mm]{keys}
523 \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
524 \describe{I1}{Initial value:\tsverb{$I_1$}}
525 \describe{I2}{Initial value:\tsverb{$I_2$}}
526 \describe{V1}{Initial value:\tsverb{$V_1$}}
527 \describe{V2}{Initial value:\tsverb{$V_2$}}
528 \describe {raw sources} {This will suppress the control variables (V1, V2) in the sources' labels}
529 \describe{Y11}{Initial value:\tsverb{$Y_{11}$}}
530 \describe{Y12}{Initial value:\tsverb{$Y_{12}$}}
531 \describe{Y21}{Initial value:\tsverb{$Y_{21}$}}
532 \describe{Y22}{Initial value:\tsverb{$Y_{22}$}}
533 \describe{Y11 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
534 \describe{Y12 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
535 \describe{Y21 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
536 \describe{Y22 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
537 \end{describelist*}
538 \begin{tsremark}
539 The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
540 \end{tsremark}
541
542 \subsection{Quad G}
543 \begin{codestore}[QuadGDef]
544 % Node use
545 node[Quad G]{}
546
547 % To path use
548 (A) to[ToQuad G] (B)
549 \end{codestore}
550
551 \tscode*[tikzquads keys]{QuadGDef}
552
553 Besides the base anchors (see \ref{quadanchors}) it has 4 internal nodes: \tsobj[key]{<node>-G11,<node>-G12,<node>-G21,<node>-G22} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
554 \begin{tsremark}
555 There is also a \tsobj[key]{ToQuad G} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
556 \end{tsremark}
557
558 \begin{center}%
559 \resizebox{0.8\textwidth}{!}{%
560 \begin{tikzpicture}
561 \draw (0,0) node[Quad G](Qa){text};
562 \pingeoanchors{Qa}
563 \draw (Qa.2+) ++(2,0) node[Quad G,anchor=1+](Qb){text};
564 \pinquadanchors{Qb}
565 \end{tikzpicture}
566 }
567 \end{center}
568 \begin{center}%
569 \resizebox{0.4\textwidth}{!}{%
570 \begin{tikzpicture}
571 \draw (0,0) node[Quad G,anchor=north](Qc){text};
572 \pinquadtextanchors{Qc}
573 \end{tikzpicture}
574 }
575 \end{center}
576
577
578 \subsubsection{Quad G keys}
579 \begin{describelist*}[30mm]{keys}
580 \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
581 \describe{I1}{Initial value:\tsverb{$I_1$}}
582 \describe{I2}{Initial value:\tsverb{$I_2$}}
583 \describe{V1}{Initial value:\tsverb{$V_1$}}
584 \describe{V2}{Initial value:\tsverb{$V_2$}}
585 \describe {raw sources} {This will suppress the control variables (V1, I2) in the sources' labels}
586 \describe{G11}{Initial value:\tsverb{$G_{11}$}}
587 \describe{G12}{Initial value:\tsverb{$G_{12}$}}
588 \describe{G21}{Initial value:\tsverb{$G_{21}$}}
589 \describe{G22}{Initial value:\tsverb{$G_{22}$}}
590 \describe{G11 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
591 \describe{G12 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
592 \describe{G21 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
593 \describe{G22 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top right}}}
594 \end{describelist*}
595 \begin{tsremark}
596 The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
597 \end{tsremark}
598
599 \subsection{Quad H}
600 \begin{codestore}[QuadHDef]
601 % Node use
602 node[Quad H]{}
603
604 % To path use
605 (A) to[ToQuad H] (B)
606 \end{codestore}
607
608 \tscode*[tikzquads keys]{QuadHDef}
609
610 Besides the base anchors (see \ref{quadanchors}) it has 4 internal nodes: \tsobj[key]{<node>-H11,<node>-H12,<node>-H21,<node>-H22} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
611 \begin{tsremark}
612 There is also a \tsobj[key]{ToQuad H} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
613 \end{tsremark}
614
615 \begin{center}%
616 \resizebox{0.8\textwidth}{!}{%
617 \begin{tikzpicture}
618 \draw (0,0) node[Quad H](Qa){text};
619 \pingeoanchors{Qa}
620 \draw (Qa.2+) ++(2,0) node[Quad H,anchor=1+](Qb){text};
621 \pinquadanchors{Qb}
622 \end{tikzpicture}
623 }
624 \end{center}
625 \begin{center}%
626 \resizebox{0.4\textwidth}{!}{%
627 \begin{tikzpicture}
628 \draw (0,0) node[Quad H,anchor=north](Qc){text};
629 \pinquadtextanchors{Qc}
630 \end{tikzpicture}
631 }
632 \end{center}
633
634
635
636 \subsubsection{Quad H keys}
637 \begin{describelist*}[30mm]{keys}
638 \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
639 \describe{I1}{Initial value:\tsverb{$I_1$}}
640 \describe{I2}{Initial value:\tsverb{$I_2$}}
641 \describe{V1}{Initial value:\tsverb{$V_1$}}
642 \describe{V2}{Initial value:\tsverb{$V_2$}}
643 \describe {raw sources} {This will suppress the control variables (I1, V2) in the sources' labels}
644 \describe{H11}{Initial value:\tsverb{$H_{11}$}}
645 \describe{H12}{Initial value:\tsverb{$H_{12}$}}
646 \describe{H21}{Initial value:\tsverb{$H_{21}$}}
647 \describe{H22}{Initial value:\tsverb{$H_{22}$}}
648 \describe{H11 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
649 \describe{H12 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
650 \describe{H21 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
651 \describe{H22 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
652 \end{describelist*}
653
654 \begin{tsremark}
655 The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
656 \end{tsremark}
657
658 ~
659
660 \section{Thevenin, Norton single port boxes}
661
662
663 \subsection{The Base Single Port / Black Box Shape}\label{BBanchors}
664
665 The base shape just draws a base box and sets some connection anchors: $1+$, $1-$, $inner\ 1+$, $inner\ 1-$, besides the geographic and text ones:
666
667
668 \begin{center}%
669 \resizebox{0.8\textwidth}{!}{%
670 \begin{tikzpicture}
671 \draw (0,0) node[Black Box](Qa){text};
672 \pingeoanchors{Qa}
673 \draw (Qa.east) ++(2,0) node[Black Box,anchor=west](Qb){text};
674 \pinblackboxanchors{Qb}
675 \draw (Qb.east) ++(2,0) node[Black Box,anchor=west](Qc){text};
676 \pinquadtextanchors{Qc}
677 \end{tikzpicture}
678 }
679 \end{center}
680
681
682 ~
683
684 \subsubsection{Base Keys}\label{BBkeys}
685
686 These applies to all \emph{Black Box} shapes:
687
688 \begin{describelist*}[30mm]{keys}
689 \describe {base width} {The 'box' width}
690 \describe {half base width} {Ditto, half width. Initial value:\tsobj{2\pgf@circ@Rlen}.}
691 \describe {base height} {The distance between \tsobj[keys]{1+,1-}. The 'box' full height is equal to 2*(\tsobj[keys]{half base height} + \tsobj[keys]{height ext} + \tsobj[keys]{height ext+}).}
692 \describe {half base height} {Ditto, half height. Initial value:\tsobj{\pgf@circ@Rlen/7} }
693 \describe {height ext}{Initial value:\tsobj{2\pgf@circ@Rlen/7}}
694 \describe {height ext+}{Initial value:0}
695 \describe {inner ext} {distance between the 'box' and \tsobj{inner 1+/1-/2+/2-}. initial value: \tsobj{\pgf@circ@Rlen/7}}
696 \describe {outer ext} {distance between the 'box' and \tsobj{1+/1-/2+/2-}. initial value: \tsobj{5\pgf@circ@Rlen/14}}
697 \describe {inner marks} {If set, the inner anchors will be marked.}
698 \describe {outer marks} {If set, the outer anchors will be marked.}
699 \describe {invert} {The shape will be inverted, more or less like 'x scale=-1'.}
700 \describe {alt, opt} {Case a Voltage source is zero, a series impedance will be draw vertically.}
701 \describe {outer x fit to} {For any Black Box, this is the same as \tsobj[key]{outer x fit to!}.}
702 \describe {outer x fit to*} {It takes 2 arguments: \tsobj[keys]{outer x fit*=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) \textbf{will fit} \tsobj[meta]{CoordA,CoordB}. This might result in a shape rotation.}
703 \describe {outer x fit to!} {It takes 2 arguments: \tsobj[keys]{outer x fit!=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that the distance between \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) will be the same as \tsobj[meta]{CoordA,CoordB}. This will never result in a shape rotation.}
704 \describe {inner x fit to} {For any Black Box, this is the same as \tsobj[key]{inner x fit to!}.}
705 \describe {inner x fit to*} {It takes 2 arguments: \tsobj[keys]{inner x fit*=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) \textbf{will fit} \tsobj[meta]{CoordA,CoordB}. This might result in a shape rotation.}
706 \describe {inner x fit to!} {It takes 2 arguments: \tsobj[keys]{inner x fit!=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that the distance between \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) will be the same as \tsobj[meta]{CoordA,CoordB}. This will never result in a shape rotation.}
707 \describe {y fit to} {For any Black Box, this is the same as \tsobj[key]{y fit to*}.}
708 \describe {y fit to*} {It takes 2 arguments: \tsobj[keys]{y fit*=}\tsargs[marg]{CoordA,CoordB}. The height will be set so that \tsobj[keys]{1+,1-} \textbf{will fit} \tsobj[keys]{CoordA,CoordB}. This might result in a shape rotation}
709 \describe {y fit to!} {It takes 2 arguments: \tsobj[keys]{y fit!=}\tsargs[marg]{CoordA,CoordB}. The height will be set so that the distance between \tsobj[meta]{1+,1-} will be equal to the distance between \tsobj[marg]{CoordA,CoordB}. This will never result in a shape rotation.}
710 \describe{label top left}{It will place a label at the top left anchor}
711 \describe{label top center}{It will place a label at the top center anchor}
712 \describe{label top right}{It will place a label at the top right anchor}
713 \describe{label inner top left}{It will place a label at the inner top left anchor}
714 \describe{label inner top center}{It will place a label at the inner top center anchor}
715 \describe{label inner top right}{It will place a label at the inner top right anchor}
716 \describe{label bottom left}{It will place a label at the bottom left anchor}
717 \describe{label bottom center}{It will place a label at the bottom center anchor}
718 \describe{label bottom right}{It will place a label at the bottom right anchor}
719 \describe{label inner bottom left}{It will place a label at the inner bottom left anchor}
720 \describe{label inner bottom center}{It will place a label at the inner bottom center anchor}
721 \describe{label inner bottom right}{It will place a label at the inner bottom right anchor}
722 \end{describelist*}
723
724 \subsection{Black Box}
725 \begin{codestore}[BBDef]
726 % Node use
727 node[Black Box]{}
728
729 % To path use
730 (A) to[ToBlack Box] (B)
731 \end{codestore}
732
733 \tscode*[tikzquads keys]{BBDef}
734 This is just the base shape, to be used in cases whereas one just want to emphasises part of a circuit (using, for instance, the \tsobj[key]{inner x fit to} key, or just mark a single port black box.
735 \begin{tsremark}
736 There is also a \tsobj[key]{ToBlack Box} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{y fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
737 \end{tsremark}
738
739 \begin{center}%
740 \resizebox{0.8\textwidth}{!}{%
741 \begin{tikzpicture}
742 \draw (0,0) node[Black Box](Qa){text};
743 \pingeoanchors{Qa}
744 \draw (Qa.east) ++(2,0) node[Black Box,anchor=west](Qb){text};
745 \pinblackboxanchors{Qb}
746 \draw (Qb.east) ++(2,0) node[Black Box,anchor=west](Qc){text};
747 \pinquadtextanchors{Qc}
748 \end{tikzpicture}
749 }
750 \end{center}
751
752 ~
753
754 \subsubsection{Black Box keys}
755 \begin{describelist*}[30mm]{keys}
756 \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
757 \describe{I1}{Initial value:\tsverb{$I_1$}}
758 \describe{V1}{Initial value:\tsverb{$V_1$}}
759 \end{describelist*}
760
761 \subsubsection{Examples of \emph{fit to} use}
762 Squeezing a Black Box between two parts of a circuit (nodes C and D):
763
764 \begin{codestore}[BBfitA]
765 \resizebox{0.4\textwidth}{!}{
766 \begin{tikzpicture}
767 \draw (0,0) \pincoord(ref) to[R=R1] ++(0,2) \pincoord(A) to[R=R2] ++(0,2) \pincoord(B)
768 -- ++(2,0) \pincoord(C,red) (C |- ref) \pincoord(C1) -- (ref);
769 \draw (C) ++(7,0) \pincoord(D,red) -- ++(0.5,0) to[R=R3] ++(0,-3) -- ++(2,0) to[R=R4] ++(0,3) -- ++(0.5,0) \pincoord(E);
770 \draw (C) node[Black Box,anchor=1+,y fit to={C}{C1},outer x fit to={C}{D}]{};
771 \end{tikzpicture}
772 }
773 \end{codestore}
774
775 \tsdemo*[tikzquads keys]{BBfitA}
776
777
778 ~
779
780 Fitting some circuit inside the Black Box (nodes C and E):
781 \begin{codestore}[BBfitB]
782 \resizebox{0.4\textwidth}{!}{
783 \begin{tikzpicture}
784 \draw (0,0) \pincoord(ref) to[R=R1] ++(0,2) \pincoord(A) to[R=R2] ++(0,2) \pincoord(B)
785 -- ++(2,0) \pincoord(C,red) (C |- ref) \pincoord(C1) -- (ref);
786 \draw (C) ++(7,0) \pincoord(D,red) -- ++(0.5,0) to[R=R3] ++(0,-3) -- ++(2,0) to[R=R4] ++(0,3) -- ++(0.5,0) \pincoord(E);
787 \draw (C) node[Black Box,anchor=inner 1+,y fit to={C}{C1},inner x fit to={C}{E}]{};
788 \end{tikzpicture}
789 }
790 \end{codestore}
791
792 \tsdemo*[tikzquads keys]{BBfitB}
793
794
795 \subsection{Thevenin}
796 \begin{codestore}[TheveninDef]
797 % Node use
798 node[Thevenin]{}
799
800 % To path use
801 (A) to[ToThevenin] (B)
802 \end{codestore}
803
804 \tscode*[tikzquads keys]{TheveninDef}
805
806
807
808
809 This is the classical Thevenin circuit. Besides the base anchors (see \ref{BBanchors}) it has 2 internal nodes: \tsobj[key]{<node>-Zth,<node>-Vth} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
810 \begin{tsremark}
811 There is also a \tsobj[key]{ToThevenin} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{y fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
812 \end{tsremark}
813
814 \begin{center}%
815 \resizebox{0.8\textwidth}{!}{%
816 \begin{tikzpicture}
817 \draw (0,0) node[Thevenin](Qa){text};
818 \pingeoanchors{Qa}
819 \draw (Qa.east) ++(2,0) node[Thevenin,anchor=west](Qb){text};
820 \pinblackboxanchors{Qb}
821 \draw (Qb.east) ++(2,0) node[Thevenin,anchor=west](Qc){text};
822 \pinquadtextanchors{Qc}
823 \end{tikzpicture}
824 }
825 \end{center}
826
827
828
829 \subsubsection{Thevenin keys}
830 \begin{describelist*}[30mm]{keys}
831 \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
832 \describe{I1}{Initial value:\tsverb{$I_1$}}
833 \describe{V1}{Initial value:\tsverb{$V_1$}}
834 \describe{Zth}{Initial value:\tsverb{$Z_{th}$}}
835 \describe{Vth}{Initial value:\tsverb{$V_{th}$}}
836 \describe{Zth label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
837 \describe{Vth label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
838 \end{describelist*}
839 \begin{tsremark}
840 The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
841 \end{tsremark}
842
843 \subsection{Norton}
844 \begin{codestore}[NortonDef]
845 % Node use
846 node[Norton]{}
847
848 % To path use
849 (A) to[ToNorton] (B)
850 \end{codestore}
851
852 \tscode*[tikzquads keys]{NortonDef}
853
854
855 This is the classical Norton circuit. Besides the base anchors (see \ref{BBanchors}) it has 2 internal nodes: \tsobj[key]{<node>-Yn,<node>-In} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
856 \begin{tsremark}
857 There is also a \tsobj[key]{ToNorton} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{y fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
858 \end{tsremark}
859
860 \begin{center}%
861 \resizebox{0.8\textwidth}{!}{%
862 \begin{tikzpicture}
863 \draw (0,0) node[Norton](Qa){text};
864 \pingeoanchors{Qa}
865 \draw (Qa.east) ++(2,0) node[Norton,anchor=west](Qb){text};
866 \pinblackboxanchors{Qb}
867 \draw (Qb.east) ++(2,0) node[Norton,anchor=west](Qc){text};
868 \pinquadtextanchors{Qc}
869 \end{tikzpicture}
870 }
871 \end{center}
872
873 \subsubsection{Norton keys}
874 \begin{describelist*}[30mm]{keys}
875 \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
876 \describe{I1}{Initial value:\tsverb{$I_1$}}
877 \describe{V1}{Initial value:\tsverb{$V_1$}}
878 \describe{Yn}{Initial value:\tsverb{$Y_{N}$}}
879 \describe{In}{Initial value:\tsverb{$I_{N}$}}
880 \describe{Yn label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
881 \describe{In label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
882 \end{describelist*}
883 \begin{tsremark}
884 The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
885 \end{tsremark}
886
887
888 \section{Pseudo-Graph Shape}
889 \begin{codestore}[PGDef]
890 % Node use
891 node[PG load line]{}
892
893 node[PG linear load line]
894 \end{codestore}
895
896 \tscode*[tikzquads keys]{PGDef}
897
898
899 Sometimes when representing a single port sub-circuit, one might use a X-Y graph, for which \tsobj[pkg]{gnuplot}\cite{gnuplot:5.4} and \tsobj[pkg]{pgfplots}\cite{PGFPLOTS:1.18} are excellent choices, but a bit overkill if all you want is a crude representation of a linear load line.
900
901 This shape is just that, a X-Y graph mockup, that nicely fits inside a black box, and nothing else.
902
903 \begin{center}%
904 % \resizebox{0.2\textwidth}{!}{%
905 \begin{tikzpicture}
906 \draw (0,0) node[PG linear load line,first quadrant](PGa){};
907 \pingeoanchors{PGa}
908 \draw (4,0) node[PG linear load line,second quadrant](PGa){};
909 \pingeoanchors{PGa}
910 \draw (8,0) node[PG linear load line,third quadrant](PGa){};
911 \pingeoanchors{PGa}
912 \draw (12,0) node[PG linear load line,fourth quadrant](PGa){};
913 \pingeoanchors{PGa}
914 \end{tikzpicture}
915 % }
916 \end{center}
917
918
919 \subsection{Pseudo-Graph Keys}
920
921 These are the keys to fine tuning a shape:
922 \begin{describelist*}[30mm]{keys}
923 \describe {x axis} {X axis \emph{name}. Initial value: $V$}
924 \describe {x val} {X axis \emph{val} at the crossing point. Initial value: $V_{th}$}
925 \describe {y axis} {Y axis \emph{name}. Initial value: $I$}
926 \describe {y val} {Y axis \emph{val} at the crossing point. Initial value: $I_{N}$}
927 \describe {first quadrant} {First quadrant mock up. (which is also the default).}
928 \describe {second quadrant} {Second quadrant mock up.}
929 \describe {third quadrant} {Third quadrant mock up.}
930 \describe {fourth quadrant} {Fourth quadrant mock up.}
931 \describe {base width} {The \emph{graph} width}
932 \describe {half base width} {Ditto, half width. Initial value:\tsobj{0.5\pgf@circ@Rlen}.}
933 \describe {base height} {The \emph{graph} height}
934 \describe {half base height} {Ditto, half height. Initial value:\tsobj{0.5\pgf@circ@Rlen}.}
935 \end{describelist*}
936 \begin{tsremark}
937 Besides these, one can also use the keys presented at \ref{generalkeys}.
938 \end{tsremark}
939
940
941 \section{Parallel Connections}\label{Parallel Conn}
942 Albeit simple, the association of quadripoles in parallel can be tedious if one has to do it many times over in a circuit. That for, an auxiliary, single command, is provided to easy it a bit.
943
944 \begin{codedescribe}[code,new=2025/03/07]{\QuadParConnect}
945 \begin{codesyntax}%
946 \tsmacro{\QuadParConnect}[options]{Quad-A,Quad-B}
947 \end{codesyntax}
948 This will interconnect one side of \tsobj[marg]{Quad-A,Quad-B} \emph{in parallel}. It is assumed that \tsobj[marg]{Quad-A} is above \tsobj[marg]{Quad-B}. New coordinates, ``\emph{c}\tsobj[marg]{Quad-Ref} \tsobj[meta]{terminals}'' (note the blank), are created at the \emph{connection terminals}, whereas \tsobj[marg]{Quad-Ref} is either \tsobj[marg]{Quad-A} (up) or \tsobj[marg]{Quad-B} (down), \tsobj[meta]{terminals} are the usual \tsobj[key]{1+,1-} (left) or \tsobj[key]{2+,2-} (right).
949 \end{codedescribe}
950 \tsobj[oarg]{options} can be any combination of:
951 \begin{describelist*}[30mm]{keys}
952 \describe {left} {The parallel connection will be done at the left side (default, assuming, terminals \tsobj[key]{1+,1-})}
953 \describe {right} {The parallel connection will be done at the right side (default, assuming, terminals \tsobj[key]{2+,2-})}
954 \describe {up} {The \emph{connection terminals} will be at the top quadripole.}
955 \describe {down} {The \emph{connection terminals} will be at the bottom quadripole.}
956 \describe {dots} {Dots will be added at the \emph{connection terminals}.}
957 \describe {spacing} {To increase/decrease the spacing between the quadripoles terminals and the connection. The default distance being the natural \tsobj[key]{out ext}.}
958 \describe {swapped sides} {If the quadripoles are inverted, and the terminals \tsobj[key]{1+,1-} are at the right side.}
959 \describe {default sides} {Thats the default. \tsobj[key]{1+,1-} are at the left side.}
960 \end{describelist*}
961
962 \begin{tsremark}
963 It is assumed that the left/right directions are along the X axis, likewise, up/down are along the Y axis.
964 \end{tsremark}
965
966 \begin{tsremark}
967 This relies on the \tsobj{\pathcross} command from the \tsobj[pkg]{tikzdotncross} package, which has to be loaded by the user.
968 \end{tsremark}
969
970 \begin{codestore}[DemoQuadConn]
971 \begin{tikzpicture}
972 \draw (0,0) node[Quad Z, anchor=1+](Q1){}
973 (Q1.south) node[Quad Y, anchor=north](Q2){};
974 \QuadParConnect[left,up,dots]{Q1}{Q2}
975 \QuadParConnect[right,down,dots]{Q1}{Q2}
976 \end{tikzpicture}
977 \end{codestore}
978
979 \begin{codestore}[DemoQuadConnB]
980 \begin{tikzpicture}
981 \draw (0,0) node[Quad Z, anchor=1+](Q1){}
982 (Q1.south) node[Quad Y, anchor=north](Q2){};
983 \QuadParConnect[left,up,dots]{Q1}{Q2}
984 \QuadParConnect[right,down,dots]{Q1}{Q2}
985 \pincoordinates{cQ1 1+/-100/4,cQ1 1-/-100/4,cQ2 2+/-55/4,cQ2 2-/-55/4}
986 \end{tikzpicture}
987 \end{codestore}
988
989 \tscode*[tikzquads keys]{DemoQuadConn}
990 \tsresult*[tikzquads keys]{DemoQuadConnB}
991
992
993
994
995 \section{Examples of use}
996
997 First of, a simple case of combining a generic Quad with equations and a generic Black Box with a Pseudo-Graph:
998
999 \begin{codestore}[DemoX]
1000 \resizebox{\textwidth}{!}{
1001 \begin{tikzpicture}
1002 \draw (0,0) \ncoord(ref) node[Quad,anchor=1+](Q1){}
1003 (Q1.2+) -- ++(1,0) \ncoord(X) -- ++(1,0) node[Black Box,anchor=1+,V1=$V_a$,I1=$I_a$](B1){}
1004 (Q1.2-) -- (B1.1-)
1005 (B1.center) node[PG linear load line,x axis=$V_a$,y axis=$I_a$]{}
1006 (Q1.center) node{$ \begin{matrix}
1007 V_1 &=& 5j*V_2 + 2*I_2 \\
1008 I_1 &=& 3*V_2 + 2j*I_2
1009 \end{matrix} $%
1010 } ;
1011 \end{tikzpicture}
1012 }
1013 \end{codestore}
1014
1015 \tsdemo*[tikzquads keys]{DemoX}
1016
1017
1018 ~
1019
1020 All default Quadripoles and Thevenin/Norton.
1021
1022 \begin{codestore}[DemoA]
1023 \resizebox{\textwidth}{!}{
1024 \begin{tikzpicture}
1025 \draw (0,0) \ncoord(ref) node[Quad Z,anchor=1+](Qz1){}
1026 (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,anchor=1+](Qy1){}
1027 (Qy1.2+) -- ++(1,0) node[Thevenin,anchor=1+](th1){}
1028 (Qz1.1-) -- ++(0,-1.5) node[Quad H,anchor=1+](Qh1){}
1029 (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,anchor=1+](Qg1){}
1030 (Qg1.2+) -- ++(1,0) node[Norton,anchor=1+](nr1){}
1031 (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
1032 (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
1033 ;
1034 \draw (X) to[R=$Rx$] (X |- Qz1.2-)
1035 (Y) to[R=$Ry$] (Y |- Qh1.2-)
1036 ;
1037 \end{tikzpicture}
1038 }
1039 \end{codestore}
1040
1041 \tsdemo*[tikzquads keys]{DemoA}
1042
1043
1044 ~
1045
1046
1047 The same demo but with all parameter $11$ and $22$ zeroed, and changing the ``control sources''
1048
1049 \begin{codestore}[DemoB]
1050 \resizebox{\textwidth}{!}{
1051 \begin{tikzpicture}
1052 \draw (0,0) \ncoord(ref) node[Quad Z,anchor=1+,Z11=0,Z22=0,I1=$I_a$,V1=$V_a$,I2=$I_b$,V2=$V_b$](Qz1){}
1053 (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,anchor=1+,Y11=0,Y22=0,I1=$I_d$,V1=$V_d$,I2=$I_c$,V2=$V_c$](Qy1){}
1054 (Qy1.2+) -- ++(1,0) node[Thevenin,anchor=1+,Zth=0,I1=$I_h$,V1=$V_h$](th1){}
1055 (Qz1.1-) -- ++(0,-1.5) node[Quad H,anchor=1+,H11=0,H22=0,I1=$I_e$,V1=$V_e$,I2=$I_e$,V2=$V_e$](Qh1){}
1056 (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,anchor=1+,G11=0,G22=0,I1=$I_g$,V1=$V_g$,I2=$I_f$,V2=$V_f$](Qg1){}
1057 (Qg1.2+) -- ++(1,0) node[Norton,anchor=1+,Yn=0,I1=$I_i$,V1=$V_i$](nr1){}
1058 (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
1059 (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
1060 ;
1061 \draw (X) to[R=$Rx$] (X |- Qz1.2-)
1062 (Y) to[R=$Ry$] (Y |- Qh1.2-)
1063 ;
1064 \end{tikzpicture}
1065 }
1066 \end{codestore}
1067
1068 \tsdemo*[tikzquads keys]{DemoB}
1069 ~
1070
1071
1072 Now with the $12$ and $21$ parameters zeroed, normal form:
1073
1074 \begin{codestore}[DemoC]
1075 \resizebox{\textwidth}{!}{
1076 \begin{tikzpicture}
1077 \draw (0,0) \ncoord(ref) node[Quad Z,anchor=1+,Z12=0,Z21=0,I1=$I_a$,V1=$V_a$,I2=$I_b$,V2=$V_b$](Qz1){}
1078 (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,anchor=1+,Y12=0,Y21=0,I1=$I_d$,V1=$V_d$,I2=$I_c$,V2=$V_c$](Qy1){}
1079 (Qy1.2+) -- ++(1,0) node[Thevenin,anchor=1+,Vth=0,I1=$I_h$,V1=$V_h$](th1){}
1080 (Qz1.1-) -- ++(0,-1.5) node[Quad H,anchor=1+,H12=0,H21=0,I1=$I_e$,V1=$V_e$,I2=$I_e$,V2=$V_e$](Qh1){}
1081 (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,anchor=1+,G12=0,G21=0,I1=$I_g$,V1=$V_g$,I2=$I_f$,V2=$V_f$](Qg1){}
1082 (Qg1.2+) -- ++(1,0) node[Norton,anchor=1+,In=0,I1=$I_i$,V1=$V_i$](nr1){}
1083 (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
1084 (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
1085 ;
1086 \draw (X) to[R=$Rx$] (X |- Qz1.2-)
1087 (Y) to[R=$Ry$] (Y |- Qh1.2-)
1088 ;
1089 \end{tikzpicture}
1090 }
1091 \end{codestore}
1092
1093 \tsdemo*[tikzquads keys]{DemoC}
1094
1095
1096 ~
1097
1098 Same as last one, but with an alternate form:
1099
1100 \begin{codestore}[DemoC]
1101 \resizebox{\textwidth}{!}{
1102 \begin{tikzpicture}
1103 \draw (0,0) \ncoord(ref) node[Quad Z,alt,anchor=1+,Z12=0,Z21=0,I1=$I_a$,V1=$V_a$,I2=$I_b$,V2=$V_b$](Qz1){}
1104 (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,alt,anchor=1+,Y12=0,Y21=0,I1=$I_d$,V1=$V_d$,I2=$I_c$,V2=$V_c$](Qy1){}
1105 (Qy1.2+) -- ++(1,0) node[Thevenin,alt,anchor=1+,Vth=0,I1=$I_h$,V1=$V_h$](th1){}
1106 (Qz1.1-) -- ++(0,-1.5) node[Quad H,alt,anchor=1+,H12=0,H21=0,I1=$I_e$,V1=$V_e$,I2=$I_e$,V2=$V_e$](Qh1){}
1107 (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,alt,anchor=1+,G12=0,G21=0,I1=$I_g$,V1=$V_g$,I2=$I_f$,V2=$V_f$](Qg1){}
1108 (Qg1.2+) -- ++(1,0) node[Norton,alt,anchor=1+,In=0,I1=$I_i$,V1=$V_i$](nr1){}
1109 (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
1110 (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
1111 ;
1112 \draw (X) to[R=$Rx$] (X |- Qz1.2-)
1113 (Y) to[R=$Ry$] (Y |- Qh1.2-)
1114 ;
1115 \end{tikzpicture}
1116 }
1117 \end{codestore}
1118
1119 \tsdemo*[tikzquads keys]{DemoC}
1120
1121 ~
1122
1123
1124
1125 Setting all parameters,some impedances as zig-zag, others as generic, per quadripole:
1126
1127
1128
1129 \begin{codestore}[DemoD]
1130 \resizebox{\textwidth}{!}{
1131 \begin{tikzpicture}
1132 \draw (0,0) \ncoord(ref) node[Quad Z,alt,round sources,european,anchor=1+,Z11=$Z_a$,Z22=$Z_b$,Z12=$Z_{re}$,Z21=$Z_{fe}$,I1=$I_a$,V1=$V_a$,I2=$I_b$,V2=$V_b$](Qz1){}
1133 (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,alt,anchor=1+,Y11=$Y_a$,Y22=$Y_b$,Y12=$Y_{re}$,Y21=$Y_{fe}$,I1=$I_d$,V1=$V_d$,I2=$I_c$,V2=$V_c$](Qy1){}
1134 (Qy1.2+) -- ++(1,0) node[Thevenin,alt,anchor=1+,Vth=$V_1$,Zth=$Z_a$,I1=$I_h$,V1=$V_h$](th1){}
1135 (Qz1.1-) -- ++(0,-1.5) node[Quad H,european,alt,anchor=1+,H11=$H_a$,H22=$H_b$,H12=$H_{re}$,H21=$H_{fe}$,I1=$I_e$,V1=$V_e$,I2=$I_e$,V2=$V_e$](Qh1){}
1136 (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,alt,anchor=1+,G11=$G_a$,G22=$G_b$,G12=$G_{re}$,G21=$G_{fe}$,I1=$I_g$,V1=$V_g$,I2=$I_f$,V2=$V_f$](Qg1){}
1137 (Qg1.2+) -- ++(1,0) node[Norton,alt,control sources,european,anchor=1+,In=$I_b$,Yn=$Y_b$,I1=$I_i$,V1=$V_i$](nr1){}
1138 (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
1139 (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
1140 ;
1141 \draw (X) to[R=$Rx$] (X |- Qz1.2-)
1142 (Y) to[R=$Ry$] (Y |- Qh1.2-)
1143 ;
1144 \end{tikzpicture}
1145 }
1146 \end{codestore}
1147
1148 \tsdemo*[tikzquads keys]{DemoD}
1149
1150
1151
1152
1153
1154 \printbibliography
1155
1156
1157 \end{document}