Electronic – Battery model LTSpice

batteriesltspice

I am trying to create a battery model in LTSpice. The battery model is comprised of a voltage source and a series resistance. However, I need the voltage source to change as the amount of charge in the battery changes (the differential of the charge = current out of the battery). In addition, the resistance needs to be a function of the current.

Can someone tell me how to do this LTSpice? The voltage sources I see are constants or sines or pulses. I cannot seem to make them a function of something (in my case the charge). Similarly for the resistance.

Best Answer

You can do that by using a "Arbitrary Behavioral Voltage or Current Sources" where you can define the arbitrarily define the behavior of you current source. I will not go in to the details of Arbitrary Behavioral Voltage or Current Sources since this is found in the Help of LTSpice

Additionally from http://ltwiki.org/index.php5?title=Undocumented_LTspice You can find the following section:

Resistors Behavioral Resistors Create a behavioral resistor by right-mouse-button clicking on its Value field and edit its value to read: R=. This feature is undocumented, but is considered permissible to use. The expression syntax is the same as for a general behavioral source (see B-sources in Help). The resistance must not go to zero and negative values can lead to convergence problems, so it is advisable to restrict its values to within a meaningful range as per the following Value example: R = limit(1,100k,V(1,2)*I(V1)) ; R stays between 1 ohm and 100k To plot an I-V curve, start by using the differential cursor to plot the voltage across the resistor. First click and hold down the left-mouse-button (red probe icon) on one side of the resistor and then drag and drop the black probe icon on the other side. Finish by dragging the mouse pointer over the x-axis (a ruler icon will appear) and the click the left mouse button to bring up the Horizontal Axis menu. Change the Quantity Plotted from "time" to "I(R1)" (assuming R1 is your behavioral resistor).