Electronic – LTspice dependent voltage sources circuit

ltspicevoltage-source

I am trying to add dependent voltage sources in LTSpice, but I need to make a voltage dependent source whose voltage depends on the average of two voltages. How can I build that in LTspice?

The circuit is like in image,
enter image description here

Best Answer

Oh, cripes. I can't believe the answers.

Here.

enter image description here

Hit F2, find "bv", drop it on the schematic, fill out the formula, hook it up somewhere. Done. Doesn't even have to be grounded. You can stick it anywhere. Simple formula, too. Couldn't be easier.

Of course, this assumes you've labeled your two sources as indicated. If they are unlabeled and just node numbers, then use the node names instead.


Per other discussion in comments, I may as well memorialize them here:

The B source is a type of nonlinear controlled source that was added to open the door to pretty much any function you might want, covering pretty much all possible cases. Starting with Spice3, they allowed a V= (for voltage) or an I= (for current.) Most elementary math functions are allowed and you can use node voltages and terminal currents in the expression. The expression is assumed by Spice to be mathematically continuous.

These pretty much had to be added to make it more convenient to create behavioral functions needed for specialized ICs or IC subfunctions, like VCOs. LTSpice has also created (for itself) a number of very much faster internal capabilities that they use to model their own ICs, so that simulating their ICs is faster and better than simulating the ICs of other manufacturers, even if you have the behavioral models for them (because using the standard behavioral B sources in your models does make them slower than if you write specialized computer code to handle your own needs.)

An E source can also be used to duplicate your function, using the "value=" syntax. But as the help in LTSpice says, "This is an alternative syntax of the behavioral source, arbitrary behavioral voltage source, B."

Different Spice implementations are faster or slower handling these, as there are optimizations that can be applied and may be, by some developers. But the B source is generally slowish (but not necessarily noticeably so.) E sources with "value=" aren't much different (obviously.) From the LTSpice help on the E source, "It is better to use a G source shunted with a resistance to approximate an E source than to use an E source. A voltage controlled current source shunted with a resistance will compute faster and cause fewer convergence problems than a voltage controlled voltage source. Also, the resultant nonzero output impedance is more representative of a practical circuit."

In general, using Spice well as a designer tool takes training and time and experience. There is, however, more than one goal in using it. If you are a developer of models for ICs working for an IC manufacturer, you probably need to know Spice extremely well to do the job well. If you are using it more as an end user of ICs and electronic parts, then your needs may be more about verifying that you didn't forget something important (Spice will often "kick you in the head," by offering you surprising results.) You often can avoid knowing too much about using Spice, unless you encounter a very slow convergence or a cryptic error message. Then you are forced to learn something more.

I'm not worried about using a B source like the OP requires. It will almost certainly converge easily. But this does depend (of course) on the rest of the circuit and the referenced nodes' behaviors. So nothing is for sure about this. But it's probably safe for the OP and probably fast enough for their needs. But if there is a problem, there is almost always a way to address it.