How to use current controlled switch (WXXXX) in kicad eeschema

I look at the ngspice-30 manual, and and Wxxxx(i.e., CSW) calls for 3 nodes, but how do I connect a voltage source to the controlling port of the switch in schematic. In text, you can specify voltage source directly (as shown in the example in section 3.2.15 on page 82), but how do you do that in eeschema’s schematic?

The below schematic won’t simulate. I got following error message:

Circuit: KiCad schematic
Background thread stopped with timeout = 0
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Fatal error: w1: unknown controlling source nc_01
doAnalyses: no such parameter on this device
run simulation(s) aborted

So how do I specify V1 for port 3 of the switch.


This is not correct. The output consists of two nodes. The input, however, is not a node, but is the name of a current carrying voltage source.

I do not think that the CSW is currently supported by Eeschema. However you may help yourself by doing the following:

Create a symbol with 2 input and 2 output nodes (or find some and “misuse” it here). Let’s call the nodes 1 and 2 for input and 3 and 4 for output.

Create a spice subcircuit model that contains the CSW and a voltage source with 0 V (see below).

Attach the subcircuit to your symbol.

Cut the line that contains the controlling current and connect it to nodes 1 and 2 of your symbol.

* example current controlled switch
.subckt curswitch 1 2 3 4
* the input, measure the current
V1 1 2 0
*the switch instance
W1 3 4 V1 myswitch
*the switch model
.model myswitch csw it=1m ih=0.2m ron=1 roff=10k

I did not test this, but you may give it a try.

In addition, access to voltage controlled switches is shown here: Adding spice components that do not exist in pspice library

What version of the library are you using? The symbols you have look like the old pspice library ones. we have better options in the Simulation_Spice lib. (more options and symbols fit the rest of the library style)

However this lib is a newcommer so you might need to manually add it to the library table if you had kicad installed with a version before this lib was added. (use the library manager or reset the lib table to default. See Library management in KiCad version 5)

Thanks! You pinpointed my misunderstanding! Vname in the WXXXX syntax is not a node!
I tried your subckt idea and it is working now! Thanks so much!

Good to know.Thanks!