circuit-json-to-spice 0.0.26 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ import { test, expect } from "bun:test"
2
+ import { circuitJsonToSpice } from "lib/circuitJsonToSpice"
3
+ import switchCircuit from "./assets/switch.json"
4
+
5
+ test(
6
+ "Switch circuit",
7
+ async () => {
8
+ const circuitJson = switchCircuit as any
9
+
10
+ const spiceNetlist = circuitJsonToSpice(circuitJson)
11
+ const spiceString = spiceNetlist.toSpiceString()
12
+
13
+ expect(spiceString).toMatchInlineSnapshot(`
14
+ "* Circuit JSON to SPICE Netlist
15
+ .MODEL SW_SW1 SW(Ron=0.1 Roff=1e9 Vt=2.5 Vh=0.1)
16
+ .MODEL NPN NPN
17
+ RR_base N1 VP_BASE 10K
18
+ VCTRL_SW1 NCTRL_SW1 0 PULSE(0 5 0 1n 1n 0.0005 0.001)
19
+ SSW1 VP_BASE N2 NCTRL_SW1 0 SW_SW1
20
+ QQ1 VP_COLLECTOR N2 0 NPN
21
+ RR_collector N1 VP_COLLECTOR 300
22
+ Vsimulation_voltage_source_0 N1 0 DC 5
23
+ .PRINT TRAN V(VP_BASE) V(VP_COLLECTOR)
24
+ .tran 0.00005 0.004 UIC
25
+ .END"
26
+ `)
27
+ },
28
+ { timeout: 10000 },
29
+ )