I am trying to simulate ON, OFF switch in this simple circuit:
V1 0 1 1.5v
Rfan1 3 4 1
S1 1 4 SW ON
Rwire1 6 5 0.00001
VV1 0 2 dc 0 
VRfan1 3 5 dc 0 
VRwire1 2 6 dc 0 
.dc V1 1.5 1.5 1
.print dc i(VV1) i(VRfan1) i(VRwire1) 
.end
but I got this error:
ngspice stopped due to error, no simulation run!
the circuit I am trying to simulate is like this one:
if I replace the switch with a resistor, the circuit will work normally.
any idea? EDIT
I have fixed my switch as the following:
S1 1 4 98 99 mySwitch ON
.model mySwitch SW vt=0 vh=1 ron=1n roff=10k

 
     
     
    
VV1 0 2 dc 0thenVRwire1 2 6 dc 0thenRwire1 6 5 0.00001. VRwire is really superfluous. You can just usei(Rwire)to get the current. And VV1 is superfluous for the same reason. In short: Don't use voltage sources for current measurement when you already have components in series with them. It's superfluous* – Huisman Jul 26 '19 at 18:36