1P3T switch model in ltspice

Thread Starter

cmartinez

Joined Jan 17, 2007
8,220
So I downloaded this pretty 1P3T switch model for LTspice. And I've already copied the .asy and .sub files to their proper directories and made this simple circuit to test it.

Capture.JPG

My question is, how do I use it? What's the instruction (.step, time, etc) that I'm supposed to use to make it change states during the simulation?

Thanks in advance
 

Attachments

crutschow

Joined Mar 14, 2008
34,284
Right click on the switch. In the window that opens, the SET function can be set to values of 1, 2, or 3 for the three switch positions.
Change the SET default value of 1 to {S} including the curly brackets (or any other variable name of your choice).

Generate the spice directive .step param S list 1 2 3 (no curly brackets).

Then when you run LTspice it will perform three simulations, one for each position of the switch.
That will work in any simulation mode.
 

eetech00

Joined Jun 8, 2013
3,859
So I downloaded this pretty 1P3T switch model for LTspice. And I've already copied the .asy and .sub files to their proper directories and made this simple circuit to test it.


My question is, how do I use it? What's the instruction (.step, time, etc) that I'm supposed to use to make it change states during the simulation?

Thanks in advance
MikeML is right...that's a funky switch...o_O

What kind of switch functionality are you lookin for?
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,220
MikeML is right...that's a funky switch...o_O

What kind of switch functionality are you lookin for?
Thanks for replying. I'm looking for something like crutschow just described. But I'd also like to learn how to use it using the time directive. That is, to make it change states during the course of a simulation.
 

eetech00

Joined Jun 8, 2013
3,859
Hi

Its straight forward in LTspice.

Use a SW device and drive its control nodes with a pulsed Voltage source.

There is an example in the LTspice examples folder
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,220
Hi

Its straight forward in LTspice.

Use a SW device and drive its control nodes with a pulsed Voltage source.

There is an example in the LTspice examples folder
Yeah... I already know how to generate a pulsed Voltage source using a voltage controlled switch, that comes included in the standard LTspice download, but they look ugly in the schematics (I'm a perfectionist, and it's a quality that I have to live with... and my wife :D)... I was just wondering about the switch devices such as the one I posted, because I'd like to learn how to model them and how they work.
 

crutschow

Joined Mar 14, 2008
34,284
Thanks for replying. I'm looking for something like crutschow just described. But I'd also like to learn how to use it using the time directive. That is, to make it change states during the course of a simulation.
Don't know of any way to make it change state during a simulation.
 

MikeML

Joined Oct 2, 2009
5,444
Don't know of any way to make it change state during a simulation.
Rewrite the three-way switch model so that it is a function of a node voltage, rather than a function of a parameter. Now use this method (or PWL) to make a voltage a function of time. This will cause the switch to change state at specified times...

152.gif
 

Attachments

eetech00

Joined Jun 8, 2013
3,859
Here is an example using your switch:

In SWpos3 I show an example using a user friendly parameter naming to set the switch.

Note that I could have run a stepped parameter version of this but I thought it would be easier for the OP if I used separate images.
 

Attachments

Thread Starter

cmartinez

Joined Jan 17, 2007
8,220
Rewrite the three-way switch model so that it is a function of a node voltage, rather than a function of a parameter. Now use this method (or PWL) to make a voltage a function of time. This will cause the switch to change state at specified times... View attachment 95953
Excellent example, Mike, thanks! Question, why can't the three-way switch model be written so that it is a function of time instead?

Here's a cool demonstration. This simulation shows the effect of switch bounce.
Very cool! as you've just said. Mind posting the asc file tor that example?

Yes you did...but I don't think the OP knows why...:(
You're right about that one... I don't yet know why
 

eetech00

Joined Jun 8, 2013
3,859
Hi cm

The reason it can't be done with your switch model is because the "SET" variable is a parameter. Parameters are computed before the simulation begins and can't be changed during. So that's why the model would have to be re-written. If you used a voltage source (like the one MikeML showed you) to control a SW, then you could change the state of the switch during transient analysis.

hope that helps...
 

Alec_t

Joined Sep 17, 2013
14,280
But I'd also like to learn how to use it using the time directive. That is, to make it change states during the course of a simulation.
Easiest to make the model switch state voltage-dependent, as Mike suggested, then add a time-dependent voltage source as the control input. With the voltage-dependent model (any number of positions) it is straightforward to model either a break-before-make or a make-before-break action.
 
Top