circuit-json-to-spice 0.0.29 → 0.0.31
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.
- package/dist/index.js +107 -25
- package/lib/circuitJsonToSpice.ts +101 -1
- package/package.json +2 -2
- package/tests/examples/assets/current-source.json +691 -0
- package/tests/examples/boost-converter.test.tsx +1 -1
- package/tests/examples/buck-converter.test.tsx +1 -1
- package/tests/examples/current-source.test.tsx +21 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { test, expect } from "bun:test"
|
|
2
|
+
import { circuitJsonToSpice } from "lib/circuitJsonToSpice"
|
|
3
|
+
import currentSourceCircuit from "./assets/current-source.json"
|
|
4
|
+
|
|
5
|
+
test("Current source circuit", async () => {
|
|
6
|
+
const circuitJson = currentSourceCircuit as any
|
|
7
|
+
|
|
8
|
+
const spiceNetlist = circuitJsonToSpice(circuitJson)
|
|
9
|
+
const spiceString = spiceNetlist.toSpiceString()
|
|
10
|
+
|
|
11
|
+
expect(spiceString).toMatchInlineSnapshot(`
|
|
12
|
+
"* Circuit JSON to SPICE Netlist
|
|
13
|
+
RR1 N1 N2 1K
|
|
14
|
+
RR2 N3 N4 1K
|
|
15
|
+
RR3 N5 N6 1K
|
|
16
|
+
Isimulation_current_source_0 N1 N2 DC 1
|
|
17
|
+
Isimulation_current_source_1 N3 N4 SIN(0 1 1000 0 0 0)
|
|
18
|
+
Isimulation_current_source_2 N5 N6 PULSE(0 0.5 0 1n 1n 0.0025 0.01)
|
|
19
|
+
.END"
|
|
20
|
+
`)
|
|
21
|
+
})
|