another LT Spice question

Jun 13, 2013 35 Replies

I have this circuit driving a pulsed laser. I want to compute the energy dumped into the laser and the energy stored in the power supply capacitors. The ballpark is 120 amps into a 20 volt laser for a few hundred microseconds.



What I did was create a "B" behavioral current source whose equation is I = V(LASER) * I(LASER) which represents power, and dump that into a 1 farad cap. The voltage on the cap is then energy in joules, and I can probe/plot that just like any other node. This works [1].



Then, for the cap energy, I made a behavioral voltage source



V = 0.5 * 1m * V(VCC)**2



where the 1m is because it's a 1000 uF cap. That gives me a probe-able node scaled 1 volt per joule. That works, but if I change the cap value I have to edit the equation. The nicer version is



V = 0.5 * C1 * V(VCC)**2



but Spice barfs on the C1 bit. Is there a way to put the cap value into the equation?


Too bad there's no integration operator available in the equations.



[1] except that it initializes to -250 megavolts. Putting a 1 ohm resistor across the cap fixes that.
John Larkin Highland Technology, Inc jlarkin at highlandtechnology dot com http://www.highlandtechnology.com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom laser drivers and controllers Photonics and fiberoptic TTL data links VME thermocouple, LVDT, synchro acquisition and simulation

You probably need to declare C1 as a parameter... see page 85 of the SCAD4 manual. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

.param c1 1m V = 0.5 * {c1} * V(VCC)**2

Yeah, that works. Of course, I have to set the value of the cap too, to {C1}.

Kinda klunky, but works. I have a 20 uF ceramic in parallel with the

1000uF alum, but it's easier to ignore it and tolerate the 2% error.

It's churlish to complain about something free and as good as LT Spice, but some sort of Valof(C1) operator would be nice, and an integration operator.

I often wind up building my own test equipment on my schematic, rather than doing math.

Thanks

John Larkin Highland Technology, Inc jlarkin at highlandtechnology dot com http://www.highlandtechnology.com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom laser drivers and controllers Photonics and fiberoptic TTL data links VME thermocouple, LVDT, synchro acquisition and simulation

.STEP PARAM C1...

It's probably "S", RTFM >:-}

We all do. It's the only way to conveniently display such information. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

I don't know if it matters in your analysis, but spice doesn't conserve charge.

It did initialize a 1 farad cap to 225 megavolts, which is more joules than my PC power supply can deliver.

formatting link

--

John Larkin Highland Technology Inc

formatting link
jlarkin at highlandtechnology dot com

Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

LTSpice does have an integration operator for it's behavioral supplies. In fact, it has a few -- one Laplace transform operator, and two time- domain integrators (one rolls over, the other limits). I've used them to simulate microprocessor control of a PWM generator in a power supply.

I can't remember more details than that, though -- try searching the manual on "integrat": that'll get you both "integrate" and "integrator".

Tim Wescott Control system and signal processing consulting www.wescottdesign.com

.MEASURE includes an integration function, but I don't understand .MEAS. I put one in my sim, but I don't see its output.

.MEAS TRAN res1 FIND V(VCC) AT=50u

It's supposed to "print" the result. Where?

John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

Oh, it goes into the log file. It's computed post-simulation.

John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

I've just been told by Helmut that LTspice does not have a .PRINT statement like all other Spice variants. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

I use the .PARAM statement all the time. LTSpice can produce these nice multi-color plots with it, those are the (few) times when I have to admit that a Windows OS has benefits over DOS.

Same here. Until last week, when I had to start solving equations in complex notation and some only worked if I used letter-A paper sideways and wrote in a very small font. Last time I did that was nineteen-sumpthin, and now that feels like doing 100 push-ups 30 years after boot camp.

Regards, Joerg http://www.analogconsultants.com/

Rather than having to redraw every time, I create symbols that perform the various test functions I need, and add them to my personal symbol library. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
[snip]

Function available in behavioral model...

idt(x[,ic[,a]])

Integrate x, optional initial condition ic, reset if a is true

(Page 103 of SCAD_4 Manual) ...Jim Thompson

-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Sometimes I do that as well. But not possible on this project. I have to develop algorithms with which later some highly non-linear sensor parameter is extracted through a labyrinth of parasitic R's, L's and C's. All while keeping in mind that the computing horsepower of a PC is not infinite.

I could hand it to college kids and they'd probably be faster doing this sort of math. But that would feel like handing over the steering wheel. Men don't do that :-)

Regards, Joerg http://www.analogconsultants.com/

When I encounter non-linear requirements, I usually resort to tables, so my measurement part just calls up a table.

(You'll remember my tool that can digitize a graph in a data sheet, straight from the graphics?) ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Yeah, but there ain't no graphics for this here system.

Regards, Joerg http://www.analogconsultants.com/

Do you have an equation? Or a PWL representation? ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

I'm normally using Cadence PSpice. In probe you just write s(var) to integrate. d(var) to differentiate. I suggest you read the manual from start to end, that will save you a lot of time in the future.

If you need the total power, write this in the Measurement Results; YatlastX(s(w(var)))/Max(Time)

Regards

Klaus

d(var) to differentiate. I suggest you read the manual from start to end, that will save you a lot of time in the future.

YatlastX(s(w(var)))/Max(Time)

I'm using PSpice as well. LTspice lacks some of the post-processing bells and whistles that you and I are accustomed to using.

(I generally write my own macro names that incorporate math, as in your total power equation, so that it appears on the graph as "TotalPower"... avoids confusing the customer ;-) ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required