4
\$\begingroup\$

I'm trying to implement at fuel cell in LTspice, using the lookup table function and a Arbitrary Behavioural Voltage Source (ABVS).

I specify the I-V relationsship from the datasheet as: V = table(I,i1,v1,i2,v2,....)

This is quite cumbersome for multiple reasons. 1) There are a lot of points for the nonlinear I-V curve 2) Values are added in the "table" as i, v, i, v,... (alternating), which gets hard to keep track of when reading and/or adding/correcting. 3) It's a lot of work whenever I need to add another I-V curve.

It there a better way to add I-V lookup table functionality to LTspice? Can I load a .csv file with the data or something similar, istead of entering it manually into the GUI.

N.B. I've tried nonlinear regression to curvefit and add as a function, but that does not make things easier...

EDIT: Thanks for the feedback, both of you! A fuel cell is simply a source of power. The I-V characteristic determines the operating point, w.r.t. the remaining circuitry and power draw - i.e. voltage is determined based on the current draw, and current is dermined by the voltage.

So the PWL file is not an option, as it assumes a predetermined transient (time) behaviour, which I don't have, prior to the simulation, this is the outcome - altough the PWL file is close to what I am looking for, but without the time dependency.

A fuel cell has a linear region for moderate current, and is nonlinear for low and high currents. So for the middle region, you can model it as a voltage source with a series resistance. But I'd like to add another layer to the analysis.

Looks like a battery, but cannot be charged or discharged - energy is always available.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ A polynomial fit would be a better idea, because a table() only provides linear interpolation between the points, which causes discontinuities in the derivative -- you're tempting the devil to spout "timestep too small" and such. Polynomials, OTOH, are continuous (if they're not pathological), but they may put a higher burden on the behavioural source. Though Horner can help quite a bit in this case. \$\endgroup\$ Apr 7 '20 at 20:36
  • \$\begingroup\$ How do I implement a polynomial fit to the model? Is it through the subcircuits? \$\endgroup\$ Apr 8 '20 at 11:45
  • \$\begingroup\$ Your edit completely changes the question: first you ask for something, now you're saying that it's no longer an option and you need something else. You already have the answer to your OP. If you have another, it's best you undo the changes and ask another question. However, it looks like you're getting into modeling, since you actually need a model for a battery/cell, which means it's no longer a case of fitting a curve. There are a few examples around, try those first, maybe they fit your needs. Otherwise, try this: tan(-1.5*x)/(tan(1.5)*(x+0.05))+1 (x=[0,1]). \$\endgroup\$ Apr 8 '20 at 13:14
  • \$\begingroup\$ The edit does not change the question - this was not the intent. I Merely tried to elaborate, because I misunderstood the answer, which was provided by vtolnetiono. This perfectly solve the problem. Thank you. \$\endgroup\$ Apr 14 '20 at 9:07
  • \$\begingroup\$ I use Excel, e.g. stackoverflow.com/questions/45637400/…. \$\endgroup\$
    – Cubrilo
    May 29 '20 at 17:10
3
\$\begingroup\$

Not sure whether that is what you really need, but I will give it a try. Since your inputs consist of I and V, I suppose you are simulating how this fuel cell is charged. Although not technically correct, you could map one of your variables (e.g. the current) to the time, and import it into LTSpice.

For example:

Let's say your I-V characteristic looks like the following, where the first column is the current and the second one the voltage. The csv file can be renamed to IV.txt

0,0
1,2
2,3
3,4
4,6
6,7
7,16

By reading out this file as a PWL file with a voltage source, the second collumn is mapped to the voltage. In order to recreate the current behavior, you can model a resistor to limit the current based on the time (current) you need, as depicted below:

circuit_1

\$\endgroup\$
5
  • \$\begingroup\$ Better yet, add a picture for OP, to see where to click for PWL file=.... Maybe OP missed it? \$\endgroup\$ Apr 7 '20 at 12:57
  • \$\begingroup\$ I updated the picture. \$\endgroup\$
    – vtolentino
    Apr 7 '20 at 15:27
  • \$\begingroup\$ Can't upvote twice. :-) \$\endgroup\$ Apr 7 '20 at 19:49
  • \$\begingroup\$ no problems ;-). I hope it helps. \$\endgroup\$
    – vtolentino
    Apr 7 '20 at 19:58
  • \$\begingroup\$ Thanks for the feedback! PWL file is close to what I'm looking for, but without the "time" aspect. \$\endgroup\$ Apr 8 '20 at 11:46

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.