html-test/test.typ

127 lines
4.4 KiB
Plaintext

#import "@preview/cetz:0.1.1"
#let resistor(text) = {
}
#let ground() = {
import cetz.draw: *
line((rel: (-0.25, 0)), (rel: (0.5,0)))
line((rel: (-0.075, -0.1)), (rel: (-0.35, 0)))
line((rel: (0.075, -0.1)), (rel: (0.2, 0)))
}
#let capacitor() = {
import cetz.draw: *
line((rel: (-0.4, 0)), (rel: (0.8,0)))
line((rel: (0, -0.2)), (rel: (-0.8, 0)), name: "capacitor")
}
#let connector() = {
}
#lorem(30)
#figure(
cetz.canvas(length: 1cm, debug: false, {
import cetz.draw: *
// let (a, b) = ((1,0), (2,0.5))
// rect(a, b, name: "test")
// content("test.center", [5V], anchor: "center")
// // set-origin("test.bottom")
// line("test.bottom", (rel: (0,-1)))
line((), (rel: (0,-.5)), mark: (start: "<"), name: "Start5V")
set-style(mark: (fill: black))
line((), (rel: (0,-.5)), mark: (start: "o"), name: "Junction5V")
rect((rel: (-0.2, 0)), (rel: (0.4, -1)), name: "res")
line("Junction5V.start", (rel: (1.5, 0)))
set-style(mark: (fill: none))
line((), (rel: (0, .5)), mark: (end: "<"), name: "J7")
line((rel: (.6, 0)), (rel: (0, -.5)), mark: (start: "<"), name: "J8")
ground()
content("res.right", [$R_1$], padding: 0.1, anchor: "left")
set-style(mark: (fill: black))
line("res.top", (rel: (0,-1)), mark: (end: "o"), name: "line")
line("line.end", (rel: (-2, 0)), mark: (end: "o"), name: "lineLeft")
line((rel: (0,0)), (rel: (0, -0.5)))
capacitor()
line("capacitor.center", (rel: (0, -0.6)))
ground()
line("line.end", (rel: (3, 0)))
rect((rel: (0, -0.2)), (rel: (1, 0.4)), name: "res")
content("res.bottom", [$R_2$], padding: 0.1, anchor: "top")
line("res.right", (rel: (1, 0)), mark: (end: "o"), name: "line")
line((rel: (0,0)), (rel: (0, -0.5)))
capacitor()
line("capacitor.center", (rel: (0, -0.6)))
ground()
set-style(mark: (fill: none))
line("line.end", (rel: (2.5, 0)), mark: (end: "<"), name: "AIN")
line(((horizontal: "AIN.end", vertical: "capacitor.end")), (rel: (-.5, 0)), mark: (start: "<"), name: "AOUT")
set-style(mark: (fill: black))
line((), (rel: (-.75, 0)), mark: (start: "o"), name:"JunctionJ2")
line((rel: (0,0)), (rel: (0, -0.6)))
ground()
line("JunctionJ2.start", (rel: (0, -.6)))
set-style(mark: (fill: none))
line((), (rel: (.5, 0)), mark: (end: "<"), name: "J2")
line("lineLeft.end", (rel: (-2, 0)), mark: (end: "<"))
line((rel: (-.2, 0)), ((rel: (-1, 0))), mark: (start: ">", end: "<"), name: "J3")
set-style(mark: (fill: black))
line((rel: (-.2,0)), (rel: (-0.75, 0)), mark: (start: ">"))
line((rel: (0,0)), (rel: (0, -0.1)))
rect((rel: (-0.2, 0)), (rel: (0.4, -1)), name: "NTC")
line((vertical: "NTC.bottom-right", horizontal: (rel: (-.65, 0))), (rel: (0, -0.15)))
line((), ("NTC.top-right", -.1, (vertical: "NTC.top-right", horizontal: (rel: (-1, 0)))))
content("NTC.left", [-t°], anchor: "right", padding: .1)
content("NTC.right", [$R_3$], anchor: "left", padding: .1)
line("NTC.top", (rel: (0, -0.1)))
line((rel: (0,0)), (rel: (0.75, 0)), mark: (end: ">"))
// content((rel: (0, 0)), [Pin 2/4 #h(5pt)], anchor: "left", name: "label")
set-style(mark: (fill: none))
line((rel: (.2, 0)), ((rel: (1, 0))), mark: (start: "<", end: ">"))
line((rel: (.2,0)), (rel: (.75, 0)), mark: (start: "<"), name: "J4")
line((rel: (0,0)), (rel: (0, -.1)))
ground()
content("J3.start", [#h(16pt) J3], anchor: "bottom", padding: .2)
content("J4.start", [#h(6pt) J4], anchor: "top", padding: .1)
content("Start5V.start", [J1 (5 V)], anchor: "bottom", padding: .3)
content("J2.end", [J2 (Gnd)], anchor: "left", padding: .3)
content("AIN.end", [J5], anchor: "left", padding: .3)
content("AIN.center", [$I_2$], anchor: "bottom", padding: .2)
content("AOUT.start", [J6], anchor: "left", padding: .3)
content("J7.end", [J7], anchor: "bottom", padding: .3)
content("J8.start", [J8], anchor: "bottom", padding: .3)
content("Junction5V.start", [$U_1$], anchor: "right", padding: .1)
// import "./circuittypst/circuitypst.typ": node, to
// to("isourceAM", (0,0), (0,3), label: $I_0$, v: h(0.5em) + $V_50$)
// to("short", (), (2,3), i: $I_10$,)
// to("R", (), (2, 0), label: [$R_1$], poles: "*-*", i: (">_", $i_1$))
// line((2,3), (4,3))
// to("R", (), (4, 0), label: [$R_2$], name: "R", i: (">_", $i_2$))
// line((), (0,0))
}),
caption: [Current Shunt]
)
#lorem(30)