¿ªÔÆÌåÓý

Trying to create a lookup table without any success


 

Hello,


I am trying to generate a value from a lookup table but unfortunately I am doing something wrong and ltspice complains. I have a V1 voltage that generates constantly 100V and I use a behavioral voltage source that I wish it will take the voltage and the output of V1 and by going through a table it will return a value. Any ideas about that?

Thansk in advance!


 

Hello,

Example:

V-source V1 connected between net "abc" and net "GND".
V1 abc 0 SINE(....)

Bv-source
V=table(V(abc), -100,20, -50, 15, 0, 5, 50, 20, 100, 30)


LTspice will use linear interpolation between the table-values.

Best regards,
Helmut


 

¿ªÔÆÌåÓý

There seems no need for the 100 V source, still less the 10 ohm load, and your .TRAN command makes no sense, since nothing varies, and the 1ps max time step is just bizarre.? You can't specify the output of a B source in the way you have written it, and in fact I don't think it will do what you want anyway. However, what you want isn't at all clear. What do you want the look-up table for?

You wrote: 'I wish it will take the voltage and the output of V1' . The output of V1 IS 'that voltage', so it's impossible to tell what you meant to do.

Best wishes
John Woodgate OOO-Own Opinions Only
J M Woodgate and Associates 
Rayleigh, Essex UK
On 2018-11-27 17:08, evangelos.liakos@... [LTspice] wrote:

?

Hello,


I am trying to generate a value from a lookup table but unfortunately I am doing something wrong and ltspice complains. I have a V1 voltage that generates constantly 100V and I use a behavioral voltage source that I wish it will take the voltage and the output of V1 and by going through a table it will return a value. Any ideas about that?

Thansk in advance!


 

evangelos.liakos, I strongly recommend NOT labeling the ground net "N".? It already has a label, which it gets from the "ground" symbol, and LTspice needs to use that label, not yours.? Don't try to attach another net name to the ground net or any other net that is already named.? ?Especially, don't try to use that other net name in an expression.? LTspice will discard your added label.? Fortunately, LTspice was able to modify your "V(Cb,N)" expression to "V(Cb,0)", so that expression did the right thing.


Please read how Tables are supposed to be used.? See this Help page:
? ? Help > LTspice > Circuit Elements > B. Arbitrary Behavioral Voltage or Current Sources
Scroll down that page until you reach "table".? The word "table" must be part of the expression.? You forgot that.? I think that was the biggest mistake.

Table() is a function.? The first parameter is where you would put "V(Cb)" (there's no need to write "V(Cb,0)" but you could).? Therefore, in your schematic you should right-click on your B1 source and change the Value line to this:
? ? V=table( V(Cb),
Change the Value2 line to this:
? ? (0,3000), (50,650), (100,490), (150,400), (200,350), (250,400), (300,300), (400,250), (500,220), (600,215), (700,210), (800,210), (900,210), (1000,210) )
Note that I've added a comma between each pair of values (I guess it's necessary), and one more close-parenthesis at the end so that the parentheses are balanced.

FYI, the schematic you uploaded was "Draft3.asc".? In the future, please choose a better filename than that, when you upload something -- the filename should mean something helpful.? Also, please upload to the "Temp" folder only.? To do that, navigate to the Temp folder first, and only then, click the Upload button.

There are many examples of Tables in our group's Files section.

As John already posted, other parts of your schematic don't make any sense; but I'm guessing you just threw this together to demonstrate Tables without trying to make it "do" anything.? Also there is a missing ground on the right half of the schematic.? B1/R3 should be grounded.

I'll upload a corrected schematic (Draft3_Lookup_Tables_fixed.asc).

Regards,
Andy