0
\$\begingroup\$

Does anybody know if it is possible to create a true relay in LTspice, one that is a true open circuit when open? The problem I am having is no matter how big I make the off resistance, there is still current flowing. This causes any resistor in series to drop voltage and mess up the simulation.

I am not sure if this is even possible, since a true open circuit actually changes the net list.

\$\endgroup\$
3
  • 5
    \$\begingroup\$ A true open circuit doesn't exist for a real relay so what you are asking for is a contradiction. \$\endgroup\$ – Andy aka Jun 25 '20 at 13:34
  • 2
    \$\begingroup\$ You can make a model like that, but I think there would be insurmountable convergence issues with the solver. \$\endgroup\$ – Spehro Pefhany Jun 25 '20 at 13:52
  • 1
    \$\begingroup\$ I think the switch models include an "open" resistance value. It might default to 1MEG. F1 and search for "switch." Can likely set this to 10GIG but as Spehro hints at, values much higher generally result in inability to converge. \$\endgroup\$ – rdtsc Jun 25 '20 at 14:00
4
\$\begingroup\$

LTSpice (and all other flavours of spice) solves generic circuits using a honkin' great matrix of nodal Vs and branch Is, so to have any term go to zero or infinity generally upsets its ability to invert and thus solve the matrix. That's why it often misbehaves when we have an open circuit, but works when we put 100 Mohm across it.

If you were writing your own simulator, you could identify an open circuit, and change the circuit topology to exclude consideration of any path between the open circuit nodes. However, no versions of Spice that I know of have this facility.

You have several options.

  • If the relay doesn't switch during your simulation - make two circuit diagrams, and solve each separately.
  • Write your own simulator.
  • Find out what the largest relay Roff is for which the simulator will still converge, and what the smallest Roff is which you can tolerate in your model. Note that in real life, Roff is never infinite, so your capacitor will run down in a week or a day. Does it matter if it runs down in a minute or a second, can your analysis allow for this? If the two ranges overlap, use an Roff in that range. If not, see one of the first two options, or work on your analysis so that you can work around a finite current.
\$\endgroup\$
2
  • \$\begingroup\$ To expand upon the first point, if performing a transient simulation, you can provide initial conditions (the final state of the first sim) to the second simulation using an IC statement: ltwiki.org/index.php?title=IC_set_initial_conditions \$\endgroup\$ – esilk Jun 25 '20 at 18:02
  • \$\begingroup\$ Thanks, everyone. I got the answer I expected, I've tried all the suggestions (except writing my own sim). Unfortunately, what I need to look at is the transition from closed to open circuit, so back to pencil and paper. Thanks again. \$\endgroup\$ – David Santos Jun 26 '20 at 14:04
0
\$\begingroup\$

Thanks, everyone. I got the answer I expected, I've tried all the suggestions (except writing my own sim). Unfortunately, what I need to look at is the transition from closed to open circuit, so back to pencil and paper. Thanks again.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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