circuit-json-to-spice 0.0.24 → 0.0.26
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 +43 -19
- package/lib/circuitJsonToSpice.ts +53 -18
- package/package.json +3 -3
- package/tests/examples/ac-voltage-source.test.tsx +2 -21
- package/tests/examples/assets/AC-voltage-source.json +474 -0
- package/tests/examples/assets/Boost-converter-circuit.json +1739 -0
- package/tests/examples/assets/circuit-with-multiple-components.json +558 -0
- package/tests/examples/assets/circuit-with-unrelated-voltage-source-components.json +3890 -0
- package/tests/examples/assets/circuit1-simple-resistor-divider.json +298 -0
- package/tests/examples/assets/example01.json +301 -0
- package/tests/examples/assets/simple-resistor-divider.json +1620 -0
- package/tests/examples/boost-converter.test.tsx +2 -71
- package/tests/examples/circuit1.test.tsx +4 -32
- package/tests/examples/circuit2.test.tsx +2 -45
- package/tests/examples/example01.test.tsx +3 -22
- package/tests/examples/voltage-divider.test.tsx +2 -49
- package/tests/unit/assets/RC-circuit-with-trace.json +354 -0
- package/tests/unit/assets/circuit-with-simulation-voltage-source.json +978 -0
- package/tests/unit/assets/single-resistor-circuit.json +190 -0
- package/tests/unit/circuit-json-conversion.test.tsx +7 -57
- package/tests/unit/voltage-probe.test.ts +75 -22
- package/tests/fixtures/getTestFixture.tsx +0 -7
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "source_project_metadata",
|
|
4
|
+
"source_project_metadata_id": "source_project_metadata_0",
|
|
5
|
+
"software_used_string": "@tscircuit/core@0.0.874"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"type": "source_group",
|
|
9
|
+
"source_group_id": "source_group_0",
|
|
10
|
+
"is_subcircuit": true,
|
|
11
|
+
"was_automatically_named": true,
|
|
12
|
+
"subcircuit_id": "subcircuit_source_group_0"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "source_port",
|
|
16
|
+
"source_port_id": "source_port_0",
|
|
17
|
+
"name": "pin1",
|
|
18
|
+
"pin_number": 1,
|
|
19
|
+
"port_hints": ["pin1", "anode", "pos", "left", "1"],
|
|
20
|
+
"source_component_id": "source_component_0",
|
|
21
|
+
"subcircuit_id": "subcircuit_source_group_0"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "source_port",
|
|
25
|
+
"source_port_id": "source_port_1",
|
|
26
|
+
"name": "pin2",
|
|
27
|
+
"pin_number": 2,
|
|
28
|
+
"port_hints": ["pin2", "cathode", "neg", "right", "2"],
|
|
29
|
+
"source_component_id": "source_component_0",
|
|
30
|
+
"subcircuit_id": "subcircuit_source_group_0",
|
|
31
|
+
"subcircuit_connectivity_map_key": "unnamedsubcircuit4_connectivity_net0"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "source_component",
|
|
35
|
+
"source_component_id": "source_component_0",
|
|
36
|
+
"ftype": "simple_resistor",
|
|
37
|
+
"name": "R1",
|
|
38
|
+
"resistance": 1000,
|
|
39
|
+
"display_resistance": "1kΩ",
|
|
40
|
+
"are_pins_interchangeable": true,
|
|
41
|
+
"source_group_id": "source_group_0"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"type": "source_net",
|
|
45
|
+
"source_net_id": "source_net_0",
|
|
46
|
+
"name": "GND",
|
|
47
|
+
"member_source_group_ids": [],
|
|
48
|
+
"is_ground": true,
|
|
49
|
+
"is_power": false,
|
|
50
|
+
"is_positive_voltage_source": false,
|
|
51
|
+
"subcircuit_id": "subcircuit_source_group_0",
|
|
52
|
+
"subcircuit_connectivity_map_key": "unnamedsubcircuit4_connectivity_net0"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"type": "source_board",
|
|
56
|
+
"source_board_id": "source_board_0",
|
|
57
|
+
"source_group_id": "source_group_0"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "source_trace",
|
|
61
|
+
"source_trace_id": "source_trace_0",
|
|
62
|
+
"connected_source_port_ids": ["source_port_1"],
|
|
63
|
+
"connected_source_net_ids": ["source_net_0"],
|
|
64
|
+
"subcircuit_id": "subcircuit_source_group_0",
|
|
65
|
+
"display_name": ".R1 > .pin2 to net.GND",
|
|
66
|
+
"subcircuit_connectivity_map_key": "unnamedsubcircuit4_connectivity_net0"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"type": "source_pin_missing_trace_warning",
|
|
70
|
+
"source_pin_missing_trace_warning_id": "source_pin_missing_trace_warning_0",
|
|
71
|
+
"message": "Port pin1 on R1 is missing a trace",
|
|
72
|
+
"source_component_id": "source_component_0",
|
|
73
|
+
"source_port_id": "source_port_0",
|
|
74
|
+
"subcircuit_id": "subcircuit_source_group_0",
|
|
75
|
+
"warning_type": "source_pin_missing_trace_warning"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "schematic_component",
|
|
79
|
+
"schematic_component_id": "schematic_component_0",
|
|
80
|
+
"center": {
|
|
81
|
+
"x": 0,
|
|
82
|
+
"y": 0
|
|
83
|
+
},
|
|
84
|
+
"size": {
|
|
85
|
+
"width": 1.1,
|
|
86
|
+
"height": 0.388910699999999
|
|
87
|
+
},
|
|
88
|
+
"source_component_id": "source_component_0",
|
|
89
|
+
"is_box_with_pins": true,
|
|
90
|
+
"symbol_name": "boxresistor_right",
|
|
91
|
+
"symbol_display_value": "1kΩ",
|
|
92
|
+
"schematic_group_id": "schematic_group_0"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"type": "schematic_group",
|
|
96
|
+
"schematic_group_id": "schematic_group_0",
|
|
97
|
+
"is_subcircuit": true,
|
|
98
|
+
"subcircuit_id": "subcircuit_source_group_0",
|
|
99
|
+
"name": "unnamed_board1",
|
|
100
|
+
"center": {
|
|
101
|
+
"x": 0,
|
|
102
|
+
"y": 0
|
|
103
|
+
},
|
|
104
|
+
"width": 0,
|
|
105
|
+
"height": 0,
|
|
106
|
+
"schematic_component_ids": [],
|
|
107
|
+
"source_group_id": "source_group_0"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "schematic_port",
|
|
111
|
+
"schematic_port_id": "schematic_port_0",
|
|
112
|
+
"schematic_component_id": "schematic_component_0",
|
|
113
|
+
"center": {
|
|
114
|
+
"x": -0.55,
|
|
115
|
+
"y": 0
|
|
116
|
+
},
|
|
117
|
+
"source_port_id": "source_port_0",
|
|
118
|
+
"facing_direction": "left",
|
|
119
|
+
"distance_from_component_edge": 0.4,
|
|
120
|
+
"pin_number": 1,
|
|
121
|
+
"display_pin_label": "anode",
|
|
122
|
+
"is_connected": false
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"type": "schematic_port",
|
|
126
|
+
"schematic_port_id": "schematic_port_1",
|
|
127
|
+
"schematic_component_id": "schematic_component_0",
|
|
128
|
+
"center": {
|
|
129
|
+
"x": 0.55,
|
|
130
|
+
"y": 0
|
|
131
|
+
},
|
|
132
|
+
"source_port_id": "source_port_1",
|
|
133
|
+
"facing_direction": "right",
|
|
134
|
+
"distance_from_component_edge": 0.4,
|
|
135
|
+
"pin_number": 2,
|
|
136
|
+
"display_pin_label": "cathode",
|
|
137
|
+
"is_connected": false
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"type": "schematic_net_label",
|
|
141
|
+
"schematic_net_label_id": "schematic_net_label_0",
|
|
142
|
+
"text": "GND",
|
|
143
|
+
"anchor_position": {
|
|
144
|
+
"x": 0.55,
|
|
145
|
+
"y": 0
|
|
146
|
+
},
|
|
147
|
+
"center": {
|
|
148
|
+
"x": 0.7000000000000001,
|
|
149
|
+
"y": 0
|
|
150
|
+
},
|
|
151
|
+
"anchor_side": "left",
|
|
152
|
+
"source_net_id": "source_net_0"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"type": "pcb_component",
|
|
156
|
+
"pcb_component_id": "pcb_component_0",
|
|
157
|
+
"center": {
|
|
158
|
+
"x": 0,
|
|
159
|
+
"y": 0
|
|
160
|
+
},
|
|
161
|
+
"width": 0,
|
|
162
|
+
"height": 0,
|
|
163
|
+
"layer": "top",
|
|
164
|
+
"rotation": 0,
|
|
165
|
+
"source_component_id": "source_component_0",
|
|
166
|
+
"subcircuit_id": "subcircuit_source_group_0",
|
|
167
|
+
"do_not_place": false,
|
|
168
|
+
"obstructs_within_bounds": true
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"type": "pcb_missing_footprint_error",
|
|
172
|
+
"pcb_missing_footprint_error_id": "pcb_missing_footprint_error_0",
|
|
173
|
+
"message": "No footprint found for component: <resistor#0 name=\".R1\" />",
|
|
174
|
+
"source_component_id": "source_component_0",
|
|
175
|
+
"error_type": "pcb_missing_footprint_error"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "pcb_board",
|
|
179
|
+
"pcb_board_id": "pcb_board_0",
|
|
180
|
+
"center": {
|
|
181
|
+
"x": 0,
|
|
182
|
+
"y": 0
|
|
183
|
+
},
|
|
184
|
+
"thickness": 1.4,
|
|
185
|
+
"num_layers": 2,
|
|
186
|
+
"width": 0,
|
|
187
|
+
"height": 0,
|
|
188
|
+
"material": "fr4"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { test, expect } from "bun:test"
|
|
2
2
|
import { circuitJsonToSpice } from "lib/circuitJsonToSpice"
|
|
3
3
|
import type { AnyCircuitElement } from "circuit-json"
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import singleResistorCircuit from "./assets/single-resistor-circuit.json"
|
|
5
|
+
import rcCircuitWithTrace from "./assets/RC-circuit-with-trace.json"
|
|
6
|
+
import circuitWithSimulationVoltageSource from "./assets/circuit-with-simulation-voltage-source.json"
|
|
6
7
|
|
|
7
8
|
test("empty circuit JSON", () => {
|
|
8
9
|
const circuitJson: AnyCircuitElement[] = []
|
|
@@ -16,18 +17,7 @@ test("empty circuit JSON", () => {
|
|
|
16
17
|
})
|
|
17
18
|
|
|
18
19
|
test("single resistor circuit", async () => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
circuit.add(
|
|
22
|
-
<board>
|
|
23
|
-
<resistor name="R1" resistance="1k" />
|
|
24
|
-
<trace from="net.GND" to={sel.R1.pin2} />
|
|
25
|
-
</board>,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
await circuit.renderUntilSettled()
|
|
29
|
-
|
|
30
|
-
const circuitJson = circuit.getCircuitJson()
|
|
20
|
+
const circuitJson = singleResistorCircuit as any
|
|
31
21
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
32
22
|
|
|
33
23
|
expect(netlist.components).toHaveLength(1)
|
|
@@ -39,21 +29,7 @@ test("single resistor circuit", async () => {
|
|
|
39
29
|
})
|
|
40
30
|
|
|
41
31
|
test("RC circuit with trace", async () => {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
circuit.add(
|
|
45
|
-
<board>
|
|
46
|
-
<resistor name="R1" resistance="1k" />
|
|
47
|
-
<capacitor name="C1" capacitance="1uF" />
|
|
48
|
-
<trace from={sel.R1.pin2} to={sel.C1.pin1} />
|
|
49
|
-
<trace from="net.GND1" to={sel.R1.pin1} />
|
|
50
|
-
<trace from="net.GND2" to={sel.C1.pin2} />
|
|
51
|
-
</board>,
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
await circuit.renderUntilSettled()
|
|
55
|
-
|
|
56
|
-
const circuitJson = circuit.getCircuitJson()
|
|
32
|
+
const circuitJson = rcCircuitWithTrace as any
|
|
57
33
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
58
34
|
|
|
59
35
|
expect(netlist.components).toHaveLength(2)
|
|
@@ -66,33 +42,7 @@ test("RC circuit with trace", async () => {
|
|
|
66
42
|
})
|
|
67
43
|
|
|
68
44
|
test("circuit with simulation voltage source", async () => {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
circuit.add(
|
|
72
|
-
<board>
|
|
73
|
-
<resistor name="R1" resistance="1k" />
|
|
74
|
-
<chip
|
|
75
|
-
name="U1"
|
|
76
|
-
footprint="soic8"
|
|
77
|
-
pinLabels={{
|
|
78
|
-
pin2: "GND",
|
|
79
|
-
pin3: "VOUT",
|
|
80
|
-
}}
|
|
81
|
-
pinAttributes={{
|
|
82
|
-
VOUT: { providesPower: true, providesVoltage: 5 },
|
|
83
|
-
GND: { providesGround: true },
|
|
84
|
-
}}
|
|
85
|
-
/>
|
|
86
|
-
<trace from={"net.VCC"} to={sel<"VOUT">("U1").VOUT} />
|
|
87
|
-
<trace from={"net.GND"} to={sel<"GND">("U1").GND} />
|
|
88
|
-
<trace from={"net.VCC"} to={sel.R1.pin1} />
|
|
89
|
-
<trace from={"net.GND"} to={sel.R1.pin2} />
|
|
90
|
-
</board>,
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
await circuit.renderUntilSettled()
|
|
94
|
-
|
|
95
|
-
const circuitJson = circuit.getCircuitJson()
|
|
45
|
+
const circuitJson = circuitWithSimulationVoltageSource as any
|
|
96
46
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
97
47
|
|
|
98
48
|
expect(netlist.components).toHaveLength(2)
|
|
@@ -118,7 +68,7 @@ test("simple switch uses simulation switch control", () => {
|
|
|
118
68
|
source_component_id: "SW1",
|
|
119
69
|
name: "SW1",
|
|
120
70
|
ftype: "simple_switch",
|
|
121
|
-
}
|
|
71
|
+
},
|
|
122
72
|
{
|
|
123
73
|
type: "source_net",
|
|
124
74
|
source_net_id: "net_gnd",
|
|
@@ -68,14 +68,15 @@ const baseCircuit: AnyCircuitElement[] = [
|
|
|
68
68
|
},
|
|
69
69
|
]
|
|
70
70
|
|
|
71
|
-
test("voltage probe with
|
|
71
|
+
test("voltage probe with signal_input_source_port_id creates .PRINT statement", () => {
|
|
72
72
|
const circuitJson: AnyCircuitElement[] = [
|
|
73
73
|
...baseCircuit,
|
|
74
74
|
{
|
|
75
75
|
type: "simulation_voltage_probe",
|
|
76
|
-
|
|
76
|
+
simulation_voltage_probe_id: "probe1",
|
|
77
|
+
signal_input_source_port_id: "R1_p2",
|
|
77
78
|
name: "VOUT",
|
|
78
|
-
}
|
|
79
|
+
},
|
|
79
80
|
]
|
|
80
81
|
|
|
81
82
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
@@ -86,14 +87,15 @@ test("voltage probe with source_port_id creates .PRINT statement", () => {
|
|
|
86
87
|
expect(spiceString).toContain(`RR2 VOUT N2 1K`)
|
|
87
88
|
})
|
|
88
89
|
|
|
89
|
-
test("voltage probe with
|
|
90
|
+
test("voltage probe with signal_input_source_net_id creates .PRINT statement", () => {
|
|
90
91
|
const circuitJson: AnyCircuitElement[] = [
|
|
91
92
|
...baseCircuit,
|
|
92
93
|
{
|
|
93
94
|
type: "simulation_voltage_probe",
|
|
94
|
-
|
|
95
|
+
simulation_voltage_probe_id: "probe1",
|
|
96
|
+
signal_input_source_net_id: "net1",
|
|
95
97
|
name: "VOUT",
|
|
96
|
-
}
|
|
98
|
+
},
|
|
97
99
|
]
|
|
98
100
|
|
|
99
101
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
@@ -109,9 +111,10 @@ test("voltage probe without transient analysis does not create .PRINT statement"
|
|
|
109
111
|
...baseCircuit.filter((e) => e.type !== "simulation_experiment"),
|
|
110
112
|
{
|
|
111
113
|
type: "simulation_voltage_probe",
|
|
112
|
-
|
|
114
|
+
simulation_voltage_probe_id: "probe1",
|
|
115
|
+
signal_input_source_port_id: "R1_p2",
|
|
113
116
|
name: "VOUT",
|
|
114
|
-
}
|
|
117
|
+
},
|
|
115
118
|
]
|
|
116
119
|
|
|
117
120
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
@@ -138,14 +141,16 @@ test("voltage probe on ground node is ignored, but other probes are not", () =>
|
|
|
138
141
|
},
|
|
139
142
|
{
|
|
140
143
|
type: "simulation_voltage_probe",
|
|
141
|
-
|
|
144
|
+
simulation_voltage_probe_id: "probe_gnd",
|
|
145
|
+
signal_input_source_port_id: "R2_p2",
|
|
142
146
|
name: "probe_gnd",
|
|
143
|
-
}
|
|
147
|
+
},
|
|
144
148
|
{
|
|
145
149
|
type: "simulation_voltage_probe",
|
|
146
|
-
|
|
150
|
+
simulation_voltage_probe_id: "probe_vout",
|
|
151
|
+
signal_input_source_port_id: "R1_p2",
|
|
147
152
|
name: "VOUT",
|
|
148
|
-
}
|
|
153
|
+
},
|
|
149
154
|
]
|
|
150
155
|
|
|
151
156
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
@@ -164,14 +169,16 @@ test("multiple voltage probes create single .PRINT statement", () => {
|
|
|
164
169
|
...baseCircuit,
|
|
165
170
|
{
|
|
166
171
|
type: "simulation_voltage_probe",
|
|
167
|
-
|
|
172
|
+
simulation_voltage_probe_id: "probe_n1",
|
|
173
|
+
signal_input_source_port_id: "R1_p1",
|
|
168
174
|
name: "N1",
|
|
169
|
-
}
|
|
175
|
+
},
|
|
170
176
|
{
|
|
171
177
|
type: "simulation_voltage_probe",
|
|
172
|
-
|
|
178
|
+
simulation_voltage_probe_id: "probe_vout",
|
|
179
|
+
signal_input_source_port_id: "R1_p2",
|
|
173
180
|
name: "VOUT",
|
|
174
|
-
}
|
|
181
|
+
},
|
|
175
182
|
]
|
|
176
183
|
|
|
177
184
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
@@ -339,19 +346,22 @@ test("probes with N-style names don't conflict with auto-generated names", () =>
|
|
|
339
346
|
// Probes
|
|
340
347
|
{
|
|
341
348
|
type: "simulation_voltage_probe",
|
|
342
|
-
|
|
349
|
+
simulation_voltage_probe_id: "probe_n1",
|
|
350
|
+
signal_input_source_port_id: "R1_p1",
|
|
343
351
|
name: "N1",
|
|
344
|
-
}
|
|
352
|
+
},
|
|
345
353
|
{
|
|
346
354
|
type: "simulation_voltage_probe",
|
|
347
|
-
|
|
355
|
+
simulation_voltage_probe_id: "probe_n2",
|
|
356
|
+
signal_input_source_port_id: "R2_p1",
|
|
348
357
|
name: "N2",
|
|
349
|
-
}
|
|
358
|
+
},
|
|
350
359
|
{
|
|
351
360
|
type: "simulation_voltage_probe",
|
|
352
|
-
|
|
361
|
+
simulation_voltage_probe_id: "probe_n4",
|
|
362
|
+
signal_input_source_port_id: "R4_p1",
|
|
353
363
|
name: "N4",
|
|
354
|
-
}
|
|
364
|
+
},
|
|
355
365
|
]
|
|
356
366
|
|
|
357
367
|
const netlist = circuitJsonToSpice(circuitJson)
|
|
@@ -373,3 +383,46 @@ test("probes with N-style names don't conflict with auto-generated names", () =>
|
|
|
373
383
|
expect(spiceString).not.toContain("V(n3)")
|
|
374
384
|
expect(spiceString).not.toContain("V(n5)")
|
|
375
385
|
})
|
|
386
|
+
|
|
387
|
+
test("differential voltage probe creates .PRINT statement", () => {
|
|
388
|
+
const circuitJson: AnyCircuitElement[] = [
|
|
389
|
+
...baseCircuit,
|
|
390
|
+
{
|
|
391
|
+
type: "simulation_voltage_probe",
|
|
392
|
+
simulation_voltage_probe_id: "probe_diff",
|
|
393
|
+
name: "VR1",
|
|
394
|
+
signal_input_source_port_id: "R1_p1",
|
|
395
|
+
reference_input_source_port_id: "R1_p2",
|
|
396
|
+
},
|
|
397
|
+
]
|
|
398
|
+
|
|
399
|
+
const netlist = circuitJsonToSpice(circuitJson)
|
|
400
|
+
const spiceString = netlist.toSpiceString()
|
|
401
|
+
|
|
402
|
+
expect(spiceString).toContain("RR1 N2 N1 1K")
|
|
403
|
+
expect(spiceString).toContain("RR2 N1 N3 1K")
|
|
404
|
+
expect(spiceString).toContain(".PRINT TRAN V(N2,N1)")
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
test("differential voltage probe without a name creates .PRINT statement", () => {
|
|
408
|
+
const circuitJson: AnyCircuitElement[] = [
|
|
409
|
+
...baseCircuit,
|
|
410
|
+
{
|
|
411
|
+
type: "simulation_voltage_probe",
|
|
412
|
+
simulation_voltage_probe_id: "probe_diff",
|
|
413
|
+
signal_input_source_port_id: "R1_p1",
|
|
414
|
+
reference_input_source_port_id: "R1_p2",
|
|
415
|
+
},
|
|
416
|
+
]
|
|
417
|
+
|
|
418
|
+
const netlist = circuitJsonToSpice(circuitJson)
|
|
419
|
+
const spiceString = netlist.toSpiceString()
|
|
420
|
+
|
|
421
|
+
// No single-ended probe to name nodes, so nodes are auto-named.
|
|
422
|
+
// R1_p1 is floating -> N2
|
|
423
|
+
// R1_p2 is on net1 -> N1
|
|
424
|
+
// Probe is on R1_p1 and R1_p2, so V(N2,N1)
|
|
425
|
+
expect(spiceString).toContain("RR1 N2 N1 1K")
|
|
426
|
+
expect(spiceString).toContain("RR2 N1 N3 1K")
|
|
427
|
+
expect(spiceString).toContain(".PRINT TRAN V(N2,N1)")
|
|
428
|
+
})
|