From 1c7b4decdbf6b2a78496499dbb055f0c2c4d20d4 Mon Sep 17 00:00:00 2001 From: alexander Date: Sun, 25 Jan 2026 01:43:59 +0100 Subject: [PATCH] Schaltungstheorie brrrrrrr --- src/cheatsheets/Schaltungstheorie.typ | 564 +++++++++++++++++++++++++- src/lib/circuit.typ | 86 ++++ src/lib/common_rewrite.typ | 2 +- 3 files changed, 632 insertions(+), 20 deletions(-) create mode 100644 src/lib/circuit.typ diff --git a/src/cheatsheets/Schaltungstheorie.typ b/src/cheatsheets/Schaltungstheorie.typ index 2719232..43286ac 100644 --- a/src/cheatsheets/Schaltungstheorie.typ +++ b/src/cheatsheets/Schaltungstheorie.typ @@ -1,10 +1,17 @@ #import "../lib/common_rewrite.typ" : * #import "@preview/mannot:0.3.1" #import "@preview/zap:0.5.0" +#import "@preview/cetz:0.4.2" +#import "../lib/circuit.typ" : * +#import "@preview/unify:0.7.1": num,qty,numrange,qtyrange #set math.mat(delim: "[") #show math.equation.where(block: true): it => math.inline(it) #set math.mat(delim: "[") +#show math.integral: it => math.limits(math.integral) +#show math.sum: it => math.limits(math.sum) +#let jVec(x) = $bold(underline(#x))$ +#let jMat(x) = $bold(#x)$ #set page( paper: "a4", @@ -20,13 +27,14 @@ align: center, columns: (1fr, 1fr, 1fr), [#align(left, datetime.today().display("[day].[month].[year]"))], - [#align(center, counter(page).display("- 1 -"))], + [#align(center, counter(page).display("– 1 –"))], [#align(right, image("../images/cc0.png", height: 5mm,))] ) ], ) #let colorAllgemein = color.hsl(105.13deg, 92.13%, 75.1%) +#let colorEigenschaften = color.hsl(145.13deg, 92.13%, 75.1%) #let colorEineTore = color.hsl(202.05deg, 92.13%, 75.1%) #let colorZweiTore = color.hsl(235.9deg, 92.13%, 75.1%) #let colorAnalyseVerfahren = color.hsl(280deg, 92.13%, 75.1%) @@ -37,22 +45,151 @@ [Schaltungstheorie] )) - #columns(4, gutter: 2mm)[ + #bgBlock(fill: colorAllgemein)[ + #subHeading(fill: colorAllgemein)[Allgemeine] + *Konzentriertheitshypotese*\ + $lambda >> d quad quad lambda = c/f quad quad c approx 3.10dot 10^8 m/s$ + + d: größe Bauteil Dimension + + f: Maximal Frequenze + + *Kirchhoff* + + #grid(columns: (1fr, 1fr), row-gutter: 5mm, [ + KCL: $sum_(k=1)^n i_k =0$ (Knotenregel) + ], [ + #cetz.canvas(length: 8mm, { + import cetz.draw: * + + circle((0, 0),radius: 1) + + line((angle: 0deg, radius: 0.2), (angle: 0deg, radius: 1.5), stroke: red) + line((angle: 120deg, radius: 1.5), (angle: 120deg, radius: 0.2), stroke: red) + line((angle: 240deg, radius: 1.5), (angle: 240deg, radius: 0.2), stroke: red) + + set-style(mark: (end: ("straight"))) + line((angle: 0deg, radius: 0.2), (angle: 0deg, radius: 0.8), stroke: red) + line((angle: 120deg, radius: 1.2), (angle: 120deg, radius: 0.4), stroke: red) + line((angle: 240deg, radius: 1.2), (angle: 240deg, radius: 0.4), stroke: red) + }) + ], [ + KVL: $sum_(k=1)^n u_k =0$ (Maschenregel) + ], [ + #zap.circuit({ + import zap: wire + import cetz.draw: * + + registerAllCustom(); + + einTor("F1", (0, -1), (0, 1)) + einTor("F2", (1.5, 0), (1.5, 1), flip: true) + einTor("F3", (1.5, 0), (1.5, -1), flip: true) + wire((0, -1), (1.5, -1)) + wire((0, 1), (1.5, 1)) + + translate((0.75, 0)) + circle((0, 0), radius: 4mm, stroke: blue) + translate((0, 1mm)) + mark((angle: 180deg, radius: 4mm), 90deg, symbol: "straight", stroke: blue, scale: 0.75) + translate((0, -2mm)) + mark((angle: 0deg, radius: 4mm), 270deg, symbol: "straight", stroke: blue, scale: 0.75) + }) + ]) + ] + #bgBlock(fill: colorEineTore)[ #subHeading(fill: colorEineTore)[Quelle Wandlung] - #zap.circuit({ - import zap: * - set-style(scale: (x: 0.75, y:0.75), fill: none) - resistor("R1", (-2, 0), (0, 0)) - vsource("V1", (-2, 0), (-2, -2)) - wire((-2, -2), (0, -2)) - node("n1", (0, 0), label: "1") - node("n2", (0, -2), label: "2") - }) + #grid( + columns: (auto, auto), + column-gutter: 3mm, + zap.circuit({ + import zap: * + registerAllCustom(); + einTor("F1", (0,0), (2,0), i: (content: $i_(cal(F),1)$, anchor: "south-east", label-distance: -10pt), + u: $u_1$ + ) + einTor("F1", (0,0), (2,0), i: (content: $i_(cal(F),2)$, anchor: "west", label-distance: -10pt, invert: true)) + }), + [ + Tor-Bedinung:\ + $i_(cal(F),2) = i_(cal(F),1)$ + ], + ) ] + #colbreak() + + #bgBlock(fill: colorEineTore)[ + #subHeading(fill: colorEineTore)[Quelle Wandlung] + + #grid( + columns: (1fr, 1fr), + align: center, + scale(x: 65%, y: 65%, + zap.circuit({ + import zap : * + import cetz.draw : line, content + + vsource("U0", (0, 1.5), (0, -1.5), fill: none) + + node("n2", (3.5,1.5), fill: false) + node("n3", (3.5,-1.5), fill: false) + + resistor("R0", "U0.in", "n2", fill: none, label: (content: $R_i$, anchor: "south", distance: 0.1)) + wire("U0.out", "n3") + + wire((2.49,1.5), "n2", i: (content: $i$, anchor: "south", invert: true)) + + set-style(mark: (end: ">", fill: black)) + line((3.5, 1.2), (3.5, -1.2), stroke: 0.5pt) + content((3.9, 0), $u$) + + line((0.7, 0.5), (0.7, -0.5), stroke: 0.5pt) + content((1.7, 0), $U_0 = I_0 / G_i$) + })), + scale(x: 65%, y: 65%, + zap.circuit({ + import zap : * + import cetz.draw : line, content + + isource("I0", (0, 1.5), (0, -1.5), fill: none) + node("n0", (2,1.5)) + node("n1", (2,-1.5)) + + node("n2", (3.5,1.5), fill: false) + node("n3", (3.5,-1.5), fill: false) + + resistor("g0", "n1", "n0", fill: none, label: (content: $G_i$, anchor: "south", distance: 0.2)) + wire("I0.in", "n0", "n2") + wire("I0.out", "n1", "n3") + wire("n0", "n2", i: (content: $i$, anchor: "south", invert: true)) + wire((0,0.6), "I0.in", i: (content: $I_0 = U_0 / R_i$, anchor: "east", invert: false, distance: 0.2)) + + set-style(mark: (end: ">", fill: black)) + line((3.5, 1.2), (3.5, -1.2), stroke: 0.5pt) + content((3.9, 0), $u$) + })), + [ + $U_0 = I_0 R_i$ + + $R_i=1/G_i$ + + $r(i) = R_i i + U_0$ + ], + [ + $I_0 = U_0 G_i$ + + $G_i=1/R_i$ + + $g(u) = G_i u + I_0$ + ] + ); + ] + + // Graphen und Matrizen #bgBlock(fill: colorAnalyseVerfahren)[ #subHeading(fill: colorAnalyseVerfahren)[Graphen und Matrizen] @@ -126,6 +263,7 @@ $bold(u_b^T i_b) = 0$ ] + // Baumkonzept #bgBlock(fill: colorAnalyseVerfahren)[ #subHeading(fill: colorAnalyseVerfahren)[Baumkonzept] KCLs: $n-1$\ @@ -134,6 +272,7 @@ Baum einzeichnen (Keine Schleifen!) ] + // Machenstrom-/Knotenpotenzial-Analyse #bgBlock(fill: colorAnalyseVerfahren)[ #subHeading(fill: colorAnalyseVerfahren)[Machenstrom-/Knotenpotenzial-Analyse] ] @@ -141,29 +280,399 @@ #bgBlock(fill: colorAnalyseVerfahren)[ #subHeading(fill: colorAnalyseVerfahren)[Reduzierte Knotenpotenzial-Analyse] ] + + #bgBlock(fill: colorZweiTore)[ + #subHeading(fill: colorZweiTore)[Zweitor Verschaltung] + #grid( + columns: (auto, auto), + gutter: 5mm, + [ + Parallel-Parallel \ + $jMat(G)_"ges" = jMat(G_1) + jMat(G_2)$ + ], + [ + #zap.circuit({ + import zap : * + + registerAllCustom(); + zweiTor("G1", (0,-6mm), $jMat(G_1)$) + zweiTor("G2", (0,6mm), $jMat(G_2)$) + + zwire("G1.in1", (-8mm, -3.5mm), (-8mm, 8.5mm), "G2.in1") + zwire("G1.in0", (-10mm, -8.5mm), (-10mm, 3.5mm), "G2.in0") + node("n0", (13mm, 8.5mm), fill: false) + node("n1", (13mm, -8.5mm), fill: false) + node("n00", (10mm, 8.5mm)) + node("n11", (8mm, -8.5mm)) + wire("n0", "n00") + wire("n1", "n11") + + zwire("G1.out1", (10mm, -3.5mm), (10mm, 8.5mm), "G2.out1") + zwire("G1.out0", (8mm, -8.5mm), (8mm, 3.5mm), "G2.out0") + node("n2", (-13mm, 8.5mm), fill: false) + node("n3", (-13mm, -8.5mm), fill: false) + node("n22", (-8mm, 8.5mm)) + node("n33", (-10mm, -8.5mm)) + wire("n2", "n22") + wire("n3", "n33") + }) + ], + [ + Seriel-Seriel \ + $jMat(G)_"ges" = jMat(G_1) + jMat(G_2)$ + ], + [ + #zap.circuit({ + import zap : * + + registerAllCustom(); + zweiTor("G1", (0,-6mm), $jMat(R_1)$) + zweiTor("G2", (0,6mm), $jMat(R_2)$) + + node("n0", (13mm, 8.5mm), fill: false) + node("n1", (13mm, -8.5mm), fill: false) + + node("n2", (-13mm, 8.5mm), fill: false) + node("n3", (-13mm, -8.5mm), fill: false) + + zwire("G1.in1", (-8mm, -3.5mm), (-8mm, 3.5mm), "G2.in0") + zwire("G1.out1", (8mm, -3.5mm), (8mm, 3.5mm), "G2.out0") + + zwire("G1.in0", "n3") + zwire("G1.out0", "n1") + zwire("G2.out1", "n0") + zwire("G2.in1", "n2") + }) + ], + [ + Seriel-Parallel \ + $jMat(H)_"ges" = jMat(H_1) + jMat(H_2)$ + ], + [ + #zap.circuit({ + import zap : * + + registerAllCustom(); + zweiTor("G1", (0,-6mm), $jMat(H_1)$) + zweiTor("G2", (0,6mm), $jMat(H_2)$) + + node("n0", (13mm, 8.5mm), fill: false) + node("n1", (13mm, -8.5mm), fill: false) + + node("n2", (-13mm, 8.5mm), fill: false) + node("n3", (-13mm, -8.5mm), fill: false) + + zwire("G1.in1", (-8mm, -3.5mm), (-8mm, 3.5mm), "G2.in0") + + zwire("G1.in0", "n3") + zwire("G2.in1", "n2") + + zwire("G1.out1", (10mm, -3.5mm), (10mm, 8.5mm), "G2.out1") + zwire("G1.out0", (8mm, -8.5mm), (8mm, 3.5mm), "G2.out0") + node("n00", (10mm, 8.5mm)) + node("n11", (8mm, -8.5mm)) + wire("n0", "n00") + wire("n1", "n11") + }) + ], + [ + Parallel-Seriel \ + $jMat(H')_"ges" = jMat(H'_1) + jMat(H'_2)$ + ], + [ + #zap.circuit({ + import zap : * + + registerAllCustom(); + zweiTor("G1", (0,-6mm), $jMat(H'_1)$) + zweiTor("G2", (0,6mm), $jMat(H'_2)$) + + node("n0", (13mm, 8.5mm), fill: false) + node("n1", (13mm, -8.5mm), fill: false) + + node("n2", (-13mm, 8.5mm), fill: false) + node("n3", (-13mm, -8.5mm), fill: false) + + zwire("G1.out1", (8mm, -3.5mm), (8mm, 3.5mm), "G2.out0") + + zwire("G1.out0", "n1") + zwire("G2.out1", "n0") + + zwire("G1.in1", (-8mm, -3.5mm), (-8mm, 8.5mm), "G2.in1") + zwire("G1.in0", (-10mm, -8.5mm), (-10mm, 3.5mm), "G2.in0") + node("n22", (-8mm, 8.5mm)) + node("n33", (-10mm, -8.5mm)) + wire("n2", "n22") + wire("n3", "n33") + }) + ], + [ + Kette normal \ + $jMat(A)_"ges" = jMat(A_1) dot jMat(A_2)$ + ], + [ + #zap.circuit({ + import zap : * + + registerAllCustom(); + zweiTor("A2", (6mm, 0), $jMat(A_2)$, height: 8mm, width: 8mm) + zweiTor("A1", (-6mm, 0), $jMat(A_1)$, height: 8mm, width: 8mm) + + node("n0", (-13mm, 2mm), fill: false) + node("n1", (-13mm, -2mm), fill: false) + node("n2", (13mm, 2mm), fill: false) + node("n3", (13mm, -2mm), fill: false) + + wire((-13mm, 2mm), "A1.in1") + wire((-13mm, -2mm), "A1.in0") + wire((13mm, 2mm), "A2.out1") + wire((13mm, -2mm), "A2.out0") + wire("A2.in1", "A1.out1") + wire("A2.in0", "A1.out0") + }) + ], + [ + Kette invers \ + $jMat(A')_"ges" = jMat(A'_2) dot jMat(A'_1)$ + ], + [ + #zap.circuit({ + import zap : * + + registerAllCustom(); + zweiTor("A2", (6mm, 0), $jMat(A'_2)$, height: 8mm, width: 8mm) + zweiTor("A1", (-6mm, 0), $jMat(A'_1)$, height: 8mm, width: 8mm) + + node("n0", (-13mm, 2mm), fill: false) + node("n1", (-13mm, -2mm), fill: false) + node("n2", (13mm, 2mm), fill: false) + node("n3", (13mm, -2mm), fill: false) + + wire((-13mm, 2mm), "A1.in1") + wire((-13mm, -2mm), "A1.in0") + wire((13mm, 2mm), "A2.out1") + wire((13mm, -2mm), "A2.out0") + wire("A2.in1", "A1.out1") + wire("A2.in0", "A1.out0") + }) + ] + ) + ], + + #bgBlock(fill: colorEineTore)[ + #subHeading(fill: colorEineTore)[Linearisierung (Ein-Tore)] + + 1. Arbeitspunkt bestimmen \ $"AP" =(u_"AP", i_"AP")$ + + 2. Ableitung $g_cal(F)(u)$/$r_cal(F)(i)$ bilden \ $g'_cal(F)(u)$/$r'_cal(F)(i)$ + + *Stromgesteuert $r(i) = u$* + + Groß-Signal: + + $i_"lin" = g_"lin" (u) = g'_cal(F)(u_"AP")(u-u_"AP") + i_"AP" = \ + g'_cal(F)(u_"AP")u - g'_cal(F)(u_"AP")u_"AP" + i_"AP" + $ + + $I_0 = i_"AP" - g'_cal(F)(u_"AP")u_"AP"$ + + $g_0 = g'_cal(F)(u_"AP")u$ + + #block( + height: 20mm, + scale(x: 75%, y: 75%, + zap.circuit({ + import zap : * + import cetz.draw : line, content + + isource("I0", (0, 1.5), (0, -1.5), fill: none) + node("n0", (2,1.5)) + node("n1", (2,-1.5)) + + node("n2", (3.5,1.5), fill: false) + node("n3", (3.5,-1.5), fill: false) + + resistor("g0", "n1", "n0", fill: none, label: (content: $g_0$, anchor: "south", distance: 0.2)) + wire("I0.in", "n0", "n2") + wire("I0.out", "n1", "n3") + wire("n0", "n2", i: (content: $i_"lin"$, anchor: "south", invert: true)) + wire((0,0.6), "I0.in", i: (content: $I_0$, anchor: "east", invert: true)) + + set-style(mark: (end: ">", fill: black)) + line((3.5, 1.2), (3.5, -1.2), stroke: 0.5pt) + content((3.9, 0), $u$) + }) + )); + + #linebreak() + + Klein-Signal:$i_"lin" = g_"lin" (u) = g'(u_"AP")u$ + + *Spannungsgesteuert $g(u) = i$* + + $u_"lin" = r_"lin" (i) = r'(i_"AP")(i-i_"AP") + u_"AP"$ + + $U_0 = u_"AP" - r'(i_"AP") i_"AP"$ + + #block( + height: 25mm, + scale(x: 75%, y: 75%, + zap.circuit({ + import zap : * + import cetz.draw : line, content + + vsource("U0", (0, 1.5), (0, -1.5), fill: none) + + node("n2", (3.5,1.5), fill: false) + node("n3", (3.5,-1.5), fill: false) + + resistor("R0", "U0.in", "n2", fill: none, label: (content: $r_0$, anchor: "south", distance: 0.1)) + wire("U0.out", "n3") + + wire((2.49,1.5), "n2", i: (content: $i$, anchor: "south", invert: true)) + + set-style(mark: (end: ">", fill: black)) + line((3.5, 1.2), (3.5, -1.2), stroke: 0.5pt) + content((3.9, 0), $u_"lin"$) + + line((0.7, 0.5), (0.7, -0.5), stroke: 0.5pt) + content((1.2, 0), $U_0$) + }) + )); + Klein-Signal: $u_"lin" = r_"lin" (i) = r'(i_"AP")i$ + ] + + #bgBlock(fill: colorEineTore)[ + #subHeading(fill: colorEineTore)[Linearisierung (Zweite-Tore)] + + 1. Arbeitspunk bestimmen $vec(jVec(u)_"AP", jVec(i)_"AP")$ + + 2. Ableitung + + ] + + #bgBlock(fill: colorEineTore)[ + #subHeading(fill: colorEineTore)[Newton-Raphson] + ] ] #pagebreak() + +// Tor Eigenschaften +#place( + bottom, float: true, scope: "parent", + bgBlock(fill: colorEigenschaften, width: 100%)[ + #subHeading(fill: colorEigenschaften)[Tor Eigenschaften] + + #table( + columns: (auto, auto, auto, auto), + inset: 2mm, + align: horizon, + table.header([], [*Ein-Tor*], [*Zwei-Tor*], [*Complex AC*]), + [*passiv*\ ($not$aktiv)], + [$forall (u,i) in cal(F): u dot i >= 0$], + [ + $jMat(U)^T jMat(I) + jMat(I)^T jMat(U)$\ + $forall vec(jVec(u),jVec(v)) in cal(F) : jVec(u)^T jVec(i) >=0$ + ], + [], + + [*verlustlos*], + [$forall (u,i) in cal(F): u dot i = 0$], + [$forall vec(jVec(u),jVec(v)) in cal(F) : jVec(u)^T jVec(i) = 0$], + [], + + + [*linear*], + [Kennline ist Gerade], + [Darstellbar: Matrix $+$ Aufpunkt], + [], + + [*quellenfrei*], + [$(qty("0", "A"), qty("0", "V")) in cal(F)$], + [], + [], + + [*streng linear*], + [linear UND quellenfrei], + [linear UND quellenfrei\ Darstellbar: Nur Matrix], + [], + + + [*ungepolt* \ (Punkt sym.)], + [$(u,i) in cal(F) <=> (-u, -i) in cal(F)$], + [ + + ], + [], + + [*symetrisch*\ $<=>$ Umkehrbar \ (Achsen sym.) ], + [$(u,i) in cal(F) <=> (u, -i) in cal(F)$], + [ + $jMat(A) = jMat(A')$\ + $jMat(G) = jMat(P) jMat(G) jMat(P), space jMat(R) = jMat(P) jMat(R) jMat(P), quad jMat(P) = mat(0, 1; 1, 0)$ + ], + [], + + [*Reziprok*], + [Immer Reziprok], + [ + $cal(F)$ symetrisch $=> cal(F)$ reziprok + + $jMat(U)^T jMat(I) - jMat(I)^T jMat(U) = 0 \ + jMat(R)^T = jMat(R), quad jMat(G)^T = jMat(G) quad h_21 = -h_12 \ det(jMat(A)) = 1 quad det(jMat(A')) = 1 quad h'_21 = -h'_12$], + [], + + [*Strom-gst.*], + [$r(i) = u$], + [], + [], + + [*Spannung-gst.*], + [$g(u) = i$] + ) + ] +) + #place(bottom+left, scope: "parent", float: true)[ #bgBlock(fill: colorZweiTore)[ + #set text(size: 10pt) + #subHeading(fill: colorZweiTore)[Umrechnung Zweitormatrizen] #table( - columns: (auto, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr), + columns: (12mm, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr), align: center, inset: (bottom: 4mm, top: 4mm), gutter: 0.1mm, - [In $->$], $bold(R)$, $bold(G)$, $bold(H)$, $bold(H')$, $bold(A)$, $bold(A')$, + fill: (x, y) => if x != 0 and calc.rem(x, 2) == 0 { rgb("#c5c5c5") } else { white }, + + table.cell( + inset: 0mm, + [ + #cetz.canvas(length: 12mm,{ + import cetz.draw : * + line((1,0), (0,1)) + content((0.309, 0.25), "Out") + content((0.75, 0.75), "In") + }) + ]), + $bold(R)$, + $bold(G)$, + $bold(H)$, + $bold(H')$, + $bold(A)$, + $bold(A')$, $bold(R)$, $mat(r_11, r_12; r_21, r_22)$, - $1/det(bold(G)) mat(g_22, -g_12; -g_21, g_11)$, + $jMat(G^(-1) =) 1/det(bold(G)) mat(g_22, -g_12; -g_21, g_11)$, $1/h_22 mat(det(bold(H)), h_12; -h_21, 1)$, $1/h'_11 mat(1, -h'_12; h'_21, det(bold(H')))$, $1/a_21 mat(a_11, det(bold(A)); 1, a_22)$, $1/a'_21 mat(a'_22, 1; det(bold(A')), a'_11)$, $bold(G)$, - $1/det(bold(R)) mat(r_22, -r_12; -r_21, r_11)$, + $jMat(R^(-1) =) 1/det(bold(R)) mat(r_22, -r_12; -r_21, r_11)$, $mat(g_11, g_12; g_21, g_22)$, $1/h_11 mat(1, -h_12; h_21, det(bold(H)))$, $1/h'_22 mat(det(bold(H')), h'_12; -h'_21, 1)$, @@ -174,14 +683,14 @@ $1/r_22 mat(det(bold(R)), r_12; -r_21, 1)$, $1/g_11 mat(1, -g_12; g_21, det(bold(G)))$, $mat(h_11, h_12; h_21, h_22)$, - $1/det(bold(H')) mat(h'_22, -h'_12; -h'_21, h'_11)$, + $jMat(H')^(-1)= 1/det(bold(H')) mat(h'_22, -h'_12; -h'_21, h'_11)$, $1/a_22 mat(a_12, det(bold(A)); -1, a_21)$, $1/a'_11 mat(a'_12, 1; -det(bold(A')), a'_21)$, $bold(H')$, $1/r_11 mat(1, -r_12; r_21, det(bold(R)))$, $1/g_22 mat(det(bold(G)), g_12; -g_21, 1)$, - $1/det(bold(H)) mat(h_22, -h_12; -h_21, h_11)$, + $jMat(H^(-1))= 1/det(bold(H)) mat(h_22, -h_12; -h_21, h_11)$, $mat(h'_11, h'_12; h'_21, h'_22)$, $1/a_11 mat(a_21, -det(bold(A)); 1, a_12)$, $1/a'_22 mat(a'_21, -1; det(bold(A')), a'_12)$, @@ -192,16 +701,33 @@ $1/h_21 mat(-det(bold(H)), -h_11; -h_22, -1)$, $1/h'_21 mat(1, h'_22; h'_11, det(bold(H')))$, $mat(a_11, a_12; a_21, a_22)$, - $1/det(bold(A')) mat(a'_22, a'_12; a'_21, a'_11)$, + $jMat(A'^(-1))= 1/det(bold(A')) mat(a'_22, a'_12; a'_21, a'_11)$, $bold(A')$, $1/r_12 mat(r_22, det(bold(R)); 1, r_11)$, $1/g_12 mat(-g_11, -1; -det(bold(G)), -g_22)$, $1/h_12 mat(1, h_11; h_22, det(bold(H)))$, $1/h'_12 mat(-det(bold(H')), -h'_22; -h'_11, -1)$, - $1/det(bold(A)) mat(a_22, a_12; a_21, a_11)$, + $jMat(A^(-1))= 1/det(bold(A)) mat(a_22, a_12; a_21, a_11)$, $mat(a'_11, a'_12; a'_21, a'_22)$, ) + + #table( + columns: (12mm, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr), + align: center, + inset: (bottom: 4mm, top: 4mm), + gutter: 0.1mm, + fill: (x, y) => if x != 0 and calc.rem(x, 2) == 0 { rgb("#c5c5c5") } else { white }, + + [], + $bold(R) jVec(i) = jVec(u)$, + $bold(G) jVec(u) = jVec(i)$, + $bold(H) vec(i_1, u_2) = vec(u_1, i_2)$, + $bold(H') vec(u_1, i_2) = vec(i_1, u_2)$, + $bold(A) vec(u_2, -i_2) = vec(i_1, u_1)$, + $bold(A') vec(u_1, -i_1) = vec(i_2, u_2)$, + + ) ] ] diff --git a/src/lib/circuit.typ b/src/lib/circuit.typ new file mode 100644 index 0000000..1e91d9d --- /dev/null +++ b/src/lib/circuit.typ @@ -0,0 +1,86 @@ +#import "@preview/cetz:0.4.2" as cetz +#import "@preview/zap:0.5.0" as zap +#import zap: interface + +#let registerAllCustom() = { + cetz.draw.set-ctx(ctx => { + ctx.zap.style.insert("einTor", ( + scale: auto, + fill: auto, + height: 3mm, + width: 6mm, + )) + ctx + }) + + cetz.draw.set-ctx(ctx => { + ctx.zap.style.insert("zweiTor", ( + scale: auto, + fill: none, + height: 10mm, + width: 10mm, + )) + ctx + }) +} + +#let einTor(name, node, flip: false, ..params) = { + import cetz.draw: rect + import zap: component + + + // Drawing function + let draw(ctx, position, style) = { + rect( + (-style.width/2, -style.height/2), + (style.width/2, style.height/2), + fill: style.fill + ) + + if(flip) { + rect( + ((style.width*0.7)/2, -(style.height)/2), + (style.width/2, style.height/2), + fill: black + ) + } else { + rect( + (-(style.width)/2, -style.height/2), + (-(style.width*0.6)/2, style.height/2), + fill: black + ) + } + + interface((-style.width / 2, -style.height / 2), (style.width / 2, style.height / 2), io: position.len() < 2) + } + + // Component call + component("einTor", name, node, draw: draw, ..params) +} + +#let zweiTor(name, node, label, ..params) = { + import cetz.draw: rect, anchor, content + import zap: component + + + // Drawing function + let draw(ctx, position, style) = { + rect( + (-style.width/2, -style.height/2), + (style.width/2, style.height/2), + fill: style.fill + ) + + content((0,0), label) + + anchor("in0", (-style.width/2, -style.height*0.5/2)) + anchor("in1", (-style.width/2, style.height*0.5/2)) + anchor("out0", (style.width/2, -style.height*0.5/2)) + anchor("out1", (style.width/2, style.height*0.5/2)) + + interface((-style.width / 2, -style.height / 2), (style.width / 2, style.height / 2), io: false) + } + + // Component call + component("zweiTor", name, node, draw: draw, ..params) +} \ No newline at end of file diff --git a/src/lib/common_rewrite.typ b/src/lib/common_rewrite.typ index bbe7e5b..5288ec3 100644 --- a/src/lib/common_rewrite.typ +++ b/src/lib/common_rewrite.typ @@ -1,4 +1,4 @@ -#let bgBlock(body, fill: color) = block(body, fill:fill.lighten(80%), width: 100%, inset: (bottom: 2mm)) +#let bgBlock(body, fill: color, width: 100%) = block(body, fill:fill.lighten(80%), width: width, inset: (bottom: 2mm)) #let SeperatorLine = line(length: 100%, stroke: (paint: black, thickness: 0.3mm)) #let MathAlignLeft(e) = {