# How to set the voltage controlled switch in Ltspice?

Status
Not open for further replies.

#### wenqinclch

##### New Member
Hi guys,

I would like to make a simulation of a electric discharge programme with Ltspice. The circuit looks like below:

At the beginning, switch 1 will be closed and the switch 2 will be opened until the voltage of capacitance Ch Uch is higher than 15kV , then we close switch 2 and open switch 1. When Uch less then 12kV will switch 1 closed and swich 2 openesd again.

Anyone know how to connect these two switches into the circuit with the tunnels + and -, and how to write the SÖPICE directive for these two switches.

#### Attachments

• 20.1 KB Views: 155
• 2.5 KB Views: 67
Last edited:

#### alec_t

##### Well-Known Member
Here's your asc file with the switch model statements.
Btw, where are you going to buy a 24.5G resistor, a 22.4femtofarad capacitor or a 6teraOhm resistor

#### Attachments

• 2.9 KB Views: 112

#### wenqinclch

##### New Member
Here's your asc file with the switch model statements.
Btw, where are you going to buy a 24.5G resistor, a 22.4femtofarad capacitor or a 6teraOhm resistor
Thanks a lot!!That is really helpful.v
One more question. Because the switches also work when the voltage is -12kV or -15kV, so, can i add another value for Vt and Vh of two switches?
like: .model ms1 sw(Roff=1 Ron=1e12 Vt=13.5k Vh=1.5k Vt=-13.5k Vh=-1.5K)

#### alec_t

##### Well-Known Member
That won't work (try it and see; that's the beauty of simulations ).
You could add two more switches: one in parallel with S1 and the other in parallel with S2. Then use model statements ms3, ms4 incorporating those negative values for vt (but +ve values for vh, otherwise the switch operates more like a potentiometer).

#### wenqinclch

##### New Member
That won't work (try it and see; that's the beauty of simulations ).
You could add two more switches: one in parallel with S1 and the other in parallel with S2. Then use model statements ms3, ms4 incorporating those negative values for vt (but +ve values for vh, otherwise the switch operates more like a potentiometer).
Done! Yes， i have tried and solved the problem already.
Thanks a lot

#### Artiom

##### New Member
Hello Guys,

I have a similar problem to solve. May you help me how to connect switch/es to control Capacitor's charge and discharge to the upper and lower limits? lets say I need to charge the cap to 8V, then connect to ground for discharging to 4V and then again connect a switch to charge up to 8V and so on. Should be a loop between 8V and 4V using its own voltage for monitoring.

Thanks