I am trying to simulate the circuit below where I have a behavioral current source whose job is to limit the current to 1m if the current in the circuit exceeds 1m. However, the circuit below doesn't work. What could be causing this problem?
-
\$\begingroup\$ When solving for an operating point, the solver encounters circular dependence of initial conditions: V(N1, N2) = R1(=1) times V(N1, N2): the matrix of coefficients is singular, LTspice informs you about this fact, and stops. By the way, your expression for B1 (I(amp) = V(volt)) looks quite awkward: you better add .param Rbi=1(Ohm) that would let you write I(amp) = V(volt)/Rbi \$\endgroup\$– V.V.TCommented Sep 4, 2023 at 14:06
-
3\$\begingroup\$ Please, for the love of all good things, don't use IF() statements in SPICE. \$\endgroup\$– Tim WilliamsCommented Sep 4, 2023 at 15:17
-
\$\begingroup\$ @TimWilliams, what alternative do you propose? \$\endgroup\$– Leonhard EulerCommented Sep 4, 2023 at 17:44
-
2\$\begingroup\$ A continuous function with a small but finite transition band is a much better choice. Consider tanh(x) for example. These can even be built from primitives -- G-sources and diodes for example. (Diodes have a typical voltage drop of some 100s mV, but Vf can be canceled out with a complementary current source and diode against which to reference it; or the input and output voltages can be scaled so that diode Vf is effectively made very small.) \$\endgroup\$– Tim WilliamsCommented Sep 4, 2023 at 17:48
-
1\$\begingroup\$ Mind, I don't know what your intent was, because your description doesn't match the circuit. A standard way to construct a circuit of such description might be a diode behind an ideal gyrator: instead of clamping voltage at Vf, voltage and current are interchanged thus current is clamped at Vf*gm. \$\endgroup\$– Tim WilliamsCommented Sep 4, 2023 at 17:50
2 Answers
I don't know why, but if you multiple the second occurrence of V(N1,N2) in the behavioral equation by 0.99999 or 1.0000001 it works (but not if you multiply it by exactly 1).
Added-- the equations look a bit circular. Try replacing the behavioral CS with a fixed CS and paralleling it with an ideal diode.
-
\$\begingroup\$ this only fixes the simulation error, but the resulting current is not what is expected. \$\endgroup\$ Commented Sep 4, 2023 at 13:52
-
\$\begingroup\$ @V.V.T It would be good if you could provide a complete answer. \$\endgroup\$ Commented Sep 4, 2023 at 15:09
-
1
-
\$\begingroup\$ No combination of initial conditions makes the solution consistent for original poster's circuit. It can be seen by inspection. The answer to the question,
What could be causing this problem?
is my comment to the OP. How to implement the circuitwhose job is to limit the current to 1m if the current in the circuit exceeds 1m
, is never asked; only stated that the proposed circuit does not work. Seeing that OP and the answerer reached full agreement in their conversation, I deleted comments supposed to prompt OP to the conclusion that the initial circuit is inconsistent in principle. \$\endgroup\$– V.V.TCommented Sep 4, 2023 at 16:29
I am back to apologize. Sorry, yesterday was not my best day, and I failed to appreciate the finest occupation joke you kindly shared to our community. All I needed to do was to stop being nerd and, instead, just relax, draw the circuit, run the analysis and enjoy!
Zoomed-in current plot:
Thank you, I have a good laugh!
For the visitors arriving at this page via search engines: joking aside, pay attention to @TimWilliams' comments.