I want to model the behaviour of a circuit in response to 'pushbutton' actions by a user. That is,

  1. Initial state;
  2. Simulate momentary button press & new state following;
  3. Likewise with a different button.

I haven't used NGSPICE for a looong time, and this sort of thing wasn't something I studied even back then. I haven't found any way to to this, or even to search properly for it, so any suggestions/help/links will be very much appreciated.



1 Answer 1


You can model initial state of a circuit by specifying node voltages at startup (using the .ic statement).

To model the switch you have a couple of options: 1. Switch Model (SW/CSW) (Ngspice manual 3.2.15) 2. Analog Switch (Ngspice manual 12.2.10) 3. Use a resistance with a parametric value: Rswitch node1 node2 R=v(controlnode) Vcontrol controlnode 0 {expression}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.