Keyboard Shortcuts
Likes
Search
.MEAS syntax with variable parameters
开云体育I’m frustrated by failure of a time measurement I’m trying to make. ? My circuit generates a pulse train with parameterized width, Pw. I want to measure a delay, from a rising edge of one node, N0, to the next rising edge of another node, Nx. Due to a filter action, the amplitude of V(nx) is dependent upon a resistor whose value is stepped, from run to run. Because of that, I want to make the trigger (target) amplitude a variable, say 90% of the MAX() amplitude of node Nx. ?
? Measurement 1 correctly returns a peak value from say 0.5V to 4.5V. Measurement 2 returns a time that’s too close to the stat of Rise, instead of near the peak level. ? T1 Fails if I use this instead:
? Help?? ? Dave ? ? |
||
开云体育I'm no expert in this area, but expressions
within { } are evaluated before simulation, which is not what
you want, of course. What if you use ordinary ( ) instead? On 2025-03-28 20:16, Bell, Dave via
groups.io wrote:
--
OOO - Own Opinions only If something is true: * as far as we know - it's science *for certain - it's mathematics *unquestionably - it's religion |
||
开云体育Yeah, with or without parens, it Fails. ? Nice feature when editing a ,MEAS (after a Run), there’s a Test button that executes the measurements on the last data set. Click. Fails! Edit. Click. Data displayed Even for .stepped runs, which returns the whole list(s)! ? From: [email protected] <[email protected]>
On Behalf Of John Woodgate
Sent: Friday, March 28, 2025 2:14 PM To: [email protected] Subject: EXTERNAL: Re: [LTspice] .MEAS syntax with variable parameters ? I'm no expert in this area, but expressions within { } are evaluated before simulation, which is not what you want, of course. What if you use ordinary ( ) instead? On 2025-03-28 20:16, Bell, Dave via groups.io wrote:
-- ?
|
||
开云体育On 28/03/2025 21:16, Bell, Dave via
groups.io wrote:
Try: .meas VNx MAX V(Nx) FROM {5*Pw} TO {25*Pw} .meas Vtarg param 0.9*VNx .meas T1 TRIG V(N0)=2.25 RISE=1 TARG V(Nx)=Vtarg TD=3u RISE=1 ..instead. (You also had 2x TD=3u in the constraints, but I guess it ignored the 2nd) Personally, I never use the Trig/Targ syntax, as it's more difficult to debug. Use an additional directive instead, then you can test Trig and Targ independently. YMMV. -- Regards, Tony |
||
开云体育Bingo!? Thanks, Tony! ? I ended up with: .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)=Vtarg TD=3u RISE=1 .meas VNx MAX V(Nx) FROM {5*Pw} TO {25*Pw} .meas Vtarg param 0.9*VNx ? Which returns the same as using cursors in the plot, but more precise and a LOT easier. ? Anther .meas feature I learned long ago is that sequence of measurements generally doesn’t matter. This way, I can put the final result on top in the list, and ignore what went into calculating it… ? Dave ? From: [email protected] <[email protected]>
On Behalf Of Tony Casey
Sent: Friday, March 28, 2025 3:31 PM To: [email protected] Subject: EXTERNAL: Re: [LTspice] .MEAS syntax with variable parameters ? On 28/03/2025 21:16, Bell, Dave via groups.io wrote:
Try: |
||
开云体育On 28/03/2025 23:46, Bell, Dave via
groups.io wrote:
Yeah. LTspice is clever about that. The parser must (silently) perform a number of iterations to determine the required evaluation precedence. I don't know whether that's generic in SPICE - I suspect it is. I guess it's not that complicated, actually. One of these days (or perhaps, nights - courtesy Eagles), I will walk/run through the original Berkeley code - I archived it years ago. (I'd better do it soon, while I can still read.?? ) --
Regards, Tony |
||