forked from HEL/circuiteria
Added simple-circuit
This commit is contained in:
parent
77cda42a72
commit
e218b894bb
36
gallery/simple-circuit.typ
Normal file
36
gallery/simple-circuit.typ
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#import "../src/lib.typ": *
|
||||||
|
#import "@preview/cetz:0.3.2": draw // For potential use of draw.hide if needed, but trying without first
|
||||||
|
|
||||||
|
#set page(width: auto, height: auto, margin: 1cm)
|
||||||
|
|
||||||
|
#circuit({
|
||||||
|
// Circuit 1: Series Lamps
|
||||||
|
electrical.voltage-source(x: 0, y: 0, w: 1, h: 1, id: "vs1")
|
||||||
|
electrical.lamp(x: 1, y: 0, w: 1, h: 1, id: "lamp1")
|
||||||
|
electrical.lamp(x: 2, y: 0, w: 1, h: 1, id: "lamp2")
|
||||||
|
|
||||||
|
// Circuit 1 Wires
|
||||||
|
wire.wire("w-s-1", ("vs1.east", "lamp1.west"))
|
||||||
|
wire.wire("w-s-2", ("lamp1.east", "lamp2.west"))
|
||||||
|
// Use dodge style for return path
|
||||||
|
wire.wire("w-s-return", ("lamp2.east", "vs1.west"), style: "dodge", dodge-y: -1.5, dodge-sides: ("east", "west"))
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
#circuit({
|
||||||
|
// Circuit 2: RC Charging
|
||||||
|
|
||||||
|
electrical.voltage-source(x: 0, y: 0, w: 1, h: 1, id: "vs")
|
||||||
|
electrical.switch(x: 2, y: 0, w: 1, h: 1, id: "sw1", closed: false)
|
||||||
|
electrical.capacitor(x: 2, y: -2, w: 1, h: 1, id: "c1")
|
||||||
|
electrical.resistor(x: 0, y: -2, w: 2, h: 1, id: "r1")
|
||||||
|
|
||||||
|
electrical.voltmeter(x: 2, y: -3, w: 1, h: 1, id: "vm")
|
||||||
|
|
||||||
|
wire.wire("w-s-1", ("vs-port-1", "sw1-port-0"))
|
||||||
|
wire.wire("w-s-2", ("c1-port-1", "sw1-port-1"))
|
||||||
|
wire.wire("w-s-3", ("r1-port-0", "vs-port-0"))
|
||||||
|
|
||||||
|
wire.wire("w-s-4", ("vm-port-0", "c1-port-0"))
|
||||||
|
wire.wire("w-s-4", ("vm-port-1", "c1-port-1"))
|
||||||
|
})
|
@ -5,3 +5,4 @@
|
|||||||
#import "gates.typ"
|
#import "gates.typ"
|
||||||
#import "util.typ"
|
#import "util.typ"
|
||||||
#import "wire.typ"
|
#import "wire.typ"
|
||||||
|
#import "electrical.typ"
|
Loading…
x
Reference in New Issue
Block a user