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.
@@ -17,7 +17,7 @@ test(
17
17
  expect(spiceString).toMatchInlineSnapshot(`
18
18
  "* Circuit JSON to SPICE Netlist
19
19
  .MODEL D D
20
- .MODEL NMOS_ENHANCEMENT NMOS
20
+ .MODEL NMOS_ENHANCEMENT NMOS (VTO=1 KP=0.1)
21
21
  LL1 N1 N2 1
22
22
  DD1 N2 N3 D
23
23
  CC1 N3 0 10U
@@ -12,7 +12,7 @@ test(
12
12
 
13
13
  expect(spiceString).toMatchInlineSnapshot(`
14
14
  "* Circuit JSON to SPICE Netlist
15
- .MODEL PMOS_ENHANCEMENT PMOS
15
+ .MODEL PMOS_ENHANCEMENT PMOS (VTO=-1 KP=0.1)
16
16
  .MODEL D D
17
17
  MM1 N2 N1 VP_IN VP_IN PMOS_ENHANCEMENT
18
18
  DD1 0 N2 D
@@ -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
+ })