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

# another LT Spice question

Started by ●June 13, 2013

Reply by ●June 13, 20132013-06-13

On Thu, 13 Jun 2013 16:22:15 -0700, John Larkin <jlarkin@highlandtechnology.com> wrote:> > >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.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.

Reply by ●June 13, 20132013-06-13

On 6/13/2013 6:22 PM, John Larkin wrote:> > > 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..param c1 1m V = 0.5 * {c1} * V(VCC)**2

Reply by ●June 13, 20132013-06-13

On Thu, 13 Jun 2013 19:46:38 -0500, John S <Sophi.2@invalid.org> wrote:>On 6/13/2013 6:22 PM, John Larkin wrote: >> >> >> 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. > >.param c1 1m >V = 0.5 * {c1} * V(VCC)**2Yeah, 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

Reply by ●June 13, 20132013-06-13

On Thu, 13 Jun 2013 18:26:09 -0700, John Larkin <jlarkin@highlandtechnology.com> wrote:>On Thu, 13 Jun 2013 19:46:38 -0500, John S <Sophi.2@invalid.org> >wrote: > >>On 6/13/2013 6:22 PM, John Larkin wrote: >>> >>> >>> 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. >> >>.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}..STEP PARAM 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.It's probably "S", RTFM >:-}> >I often wind up building my own test equipment on my schematic, rather >than doing math. > >ThanksWe 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.

Reply by ●June 14, 20132013-06-14

Reply by ●June 14, 20132013-06-14

On Thu, 13 Jun 2013 20:34:23 -0700, miso <miso@sushi.com> wrote:>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. https://dl.dropboxusercontent.com/u/53724080/Truckee/Exit201.jpg -- 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

Reply by ●June 14, 20132013-06-14

On Thu, 13 Jun 2013 18:26:09 -0700, John Larkin wrote:> 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.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

Reply by ●June 14, 20132013-06-14

On Fri, 14 Jun 2013 08:34:07 -0500, Tim Wescott <tim@seemywebsite.please> wrote:>On Thu, 13 Jun 2013 18:26:09 -0700, John Larkin wrote: > >> 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. > >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"..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

Reply by ●June 14, 20132013-06-14

On Fri, 14 Jun 2013 06:48:40 -0700, John Larkin <jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:>On Fri, 14 Jun 2013 08:34:07 -0500, Tim Wescott <tim@seemywebsite.please> wrote: > >>On Thu, 13 Jun 2013 18:26:09 -0700, John Larkin wrote: >> >>> 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. >> >>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". > > >.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?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