circuit-json-to-spice 0.0.27 → 0.0.29
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.
|
@@ -17,12 +17,12 @@ test(
|
|
|
17
17
|
expect(spiceString).toMatchInlineSnapshot(`
|
|
18
18
|
"* Circuit JSON to SPICE Netlist
|
|
19
19
|
.MODEL D D
|
|
20
|
-
.MODEL
|
|
20
|
+
.MODEL NMOS_ENHANCEMENT NMOS
|
|
21
21
|
LL1 N1 N2 1
|
|
22
22
|
DD1 N2 N3 D
|
|
23
23
|
CC1 N3 0 10U
|
|
24
24
|
RR1 N3 0 1K
|
|
25
|
-
|
|
25
|
+
MM1 N2 N4 0 0 NMOS_ENHANCEMENT
|
|
26
26
|
Vsimulation_voltage_source_0 N1 0 DC 5
|
|
27
27
|
Vsimulation_voltage_source_1 N4 0 PULSE(0 10 0 1n 1n 0.00068 0.001)
|
|
28
28
|
.END"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { test, expect } from "bun:test"
|
|
2
|
+
import { circuitJsonToSpice } from "lib/circuitJsonToSpice"
|
|
3
|
+
import buckConverterCircuit from "./assets/buck-converter.json"
|
|
4
|
+
|
|
5
|
+
test(
|
|
6
|
+
"Buck converter circuit",
|
|
7
|
+
async () => {
|
|
8
|
+
const circuitJson = buckConverterCircuit 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 PMOS_ENHANCEMENT PMOS
|
|
16
|
+
.MODEL D D
|
|
17
|
+
MM1 N2 N1 VP_IN VP_IN PMOS_ENHANCEMENT
|
|
18
|
+
DD1 0 N2 D
|
|
19
|
+
LL1 N2 VP_OUT 10
|
|
20
|
+
CC1 VP_OUT 0 10U
|
|
21
|
+
RR1 VP_OUT 0 1K
|
|
22
|
+
Vsimulation_voltage_source_0 VP_IN 0 DC 5
|
|
23
|
+
Vsimulation_voltage_source_1 N1 0 PULSE(0 10 0 1n 1n 0.0005 0.001)
|
|
24
|
+
.PRINT TRAN V(VP_IN) V(VP_OUT)
|
|
25
|
+
.tran 0.00001 0.05 UIC
|
|
26
|
+
.END"
|
|
27
|
+
`)
|
|
28
|
+
},
|
|
29
|
+
{ timeout: 10000 },
|
|
30
|
+
)
|