开云体育

.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.

?

  1. .meas VNx MAX V(Nx) FROM {5*Pw} TO {25*Pw}
  2. .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)=250m TD=3u RISE=1

?

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:

  1. .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)={0.9*VNx} TD=3u RISE=1

?

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:

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.

?

  1. .meas VNx MAX V(Nx) FROM {5*Pw} TO {25*Pw}
  2. .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)=250m TD=3u RISE=1

?

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:

  1. .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)={0.9*VNx} TD=3u RISE=1

?

Help??

?

Dave

?

?

--
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

Virus-free.


 

开云体育

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:

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.

?

  1. .meas VNx MAX V(Nx) FROM {5*Pw} TO {25*Pw}
  2. .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)=250m TD=3u RISE=1

?

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:

  1. .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)={0.9*VNx} TD=3u RISE=1

?

Help??

?

Dave

?

?

--
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

?

Virus-free.


 

开云体育

On 28/03/2025 21:16, Bell, Dave via groups.io wrote:

T1 Fails if I use this instead:

  1. .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)={0.9*VNx} TD=3u RISE=1
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:

T1 Fails if I use this instead:

  1. .meas T1 TRIG V(N0)=2.25 TD=3u RISE=1 TARG V(Nx)={0.9*VNx} TD=3u RISE=1

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


 

开云体育

On 28/03/2025 23:46, Bell, Dave via groups.io wrote:

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…

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


 

Eagles? Tony, well...?
,?
8-)