Toggle Switches Shortcut

Is there a shortcut to toggle switches on and off?

by StuntMonkeh
January 09, 2014

If you are not using the Time or Voltage Controlled switches (i.e. you are using the static switches) then double click on the symbol in your schematic (or select > right click > Edit Parameters) and set the STATE parameter to 'closed' or 'open'.

Alternatively, use the Time Controlled or Voltage Controlled switches.

More about switches in CL

How to simulate opening or closing a switch so that you don’t have to go back and forth between build and simulate modes to see the circuit operation in both states.

There are at least 3 ways to do this.

i) You can do sims with swept parameters where the swept parameter is the switch state.

ii) Or use the time controlled switch.

iii) Or use the voltage controlled switch (driven by a suitable pulse source).

This thread gives some more information about these techniques:

https://www.circuitlab.com/forums/modeling-and-simulation/topic/v476bfdj/is-there-a-model-for-a-male-power-jack/

A simple 'ON if the power is plugged in or OFF if it is not' jack can be represented by a normally open (SPST no) switch.

It could equally be represented by a normally closed (SPST nc) switch if the power is normally plugged in.

The sort of jack that physically reconnects between say an internal battery and an external supply can be represented by a changeover switch (SPDT).

i) You can use any of the CL switches and draw a box round it with some text to explain what it represents;

ii) if you use the 'static' switches as shown in:

https://www.circuitlab.com/circuit/2xpye8/

then in one run, you can simulate the circuit once with the switch open and once with the switch closed.

However, note that if you use the static changeover switches like the SPDT shown in:

https://www.circuitlab.com/circuit/954hs2/

then you cannot see the results of the A switch closed (B open) and then the B switch closed (A open) in one simulation run because you cannot select the switch state as a sweepable parameter. You have to do two simulation runs which is a bit naff.

iii) if you use the time controlled SPDT switch then you can simulate how the circuit behaves with the switch in the before the changeover state and then in the after the changeover state;

iv) you can use two voltage controlled switches driven by a PWS() or PWSREPEAT() source to make an SPDT switch which you can switch any time you like:

https://www.circuitlab.com/circuit/d66f6n/

(see:

https://www.circuitlab.com/docs/expressions/

and

https://www.circuitlab.com/docs/circuit-elements/#behavioralsources

for more about the PWS() source)

Note that it is not clearly documented but switches in CL do not have an infinite OFF state resistance.

This can lead to unexpected results.

For example, a DC plot of this circuit:

https://www.circuitlab.com/circuit/586t3d/voltage-controlled-switch-off-state-resistance-01/

with R1 removed from the circuit would show V(output) = 1V.

Here's why.

The resistance to ground at the Output node is infinite because it is an open circuit. However, the switches in CL are not ideal. They have a very large but finite OFF resistance. Therefore when operating into an open circuit load there would be no difference between the ON and OFF state voltages at the Output node.

The example demonstrates this using a DC Sweep probing V(output) with a Decade Sweep of the value of R1 (R1.R) from 1e12 to 1e18 at 10 points/Decade.

It can be seen that V(Output) = 0.5V when R1.R is equal to around 1e15 Ohms.

This is the undocumented OFF state resistance of the CL voltage controlled switch.

Note that if a CL voltmeter were to be connected in place of R1 then there would be a clear ON/OFF state difference because the CL Voltmeter has a user definable finite resistance with a default value of 1G.

by signality
January 09, 2014

Hi S Thanx for your wise words. I was intrigued by the notion that switch contacts in CL do not have infinite res when opn. A moments thought shows its obvious it cant be like that (cant solve for infinity singularities). So a nominal 1e15 ohm res is put to ground. - Yes great, got it

My Q is , are there any other little tricks like that one should know

Cheers

Robin

by robint
March 29, 2014

I had a play with CL's capacitors ...

https://www.circuitlab.com/circuit/nt8z84/finding-the-parallel-resistance-across-cl-capacitors-01/

There's probably a finite resistance in parallel with their inductors too but I haven't checked that.

The trouble is that, unlike spice, very little of this sort of stuff is documented in CL and the unexpected results these parasisitcs sometimes produce can really baffle new users.

I come from a spice user background so I'm aware of some of these things and have made some notes to self about them which I copy out to answer the odd user query.

:)

by signality
March 30, 2014

Hi S

I followed up on yor capacitor tip, and indeed came to the same conclusion of 1e18 ohms

What I dont understand is the need for non disclosure of how elements are simulated?

Given that failure to recognise these attributes can give erroneous results and wast time trying to de-bug the fault.

I came across the SPICE model http://www.ecircuitcenter.com/Circuits/cmodel1/cmodel1.htm

which i expect you know about

then you can get really down to it with

http://www.avx.com/docs/techinfo/TANTALUM_MODEL.pdf

Surely it discredits CL's value by not highlighting the SW leakage res 1e15ohms for example.

Cheers

Robin

by robint
April 01, 2014

Post a Reply

Please sign in or create an account to comment.

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.