HSPICE - Paramterized output variables

P

Paul

Guest
If am measuring something, as follows:

..MEASURE energy INTEGRAL PAR='P(a) + P(b)' FROM=1ns TO=2ns

The stuff I'm integrating is a function of various instantaneous
powers from my test circuit. I am trying to write a script that will
allow me to re-use a series of .MEASURE statements similar to the one
above, but I can't quite get the syntax right. I'm not that
experienced so maybe what I'm trying to do is not even possible...

Basically what I want to do is replace the stuff in the PAR field
above with a parameter that I can define elsewhere. Like this:
..MEASURE energy INTEGRAL powers FROM....
with powers defined:
..PARAM powers='P(a) + P(b)', but that doesn't work, so I tried
..MEASURE powers PARAM='P(a) + P(b)
The latter ran successfully but it only gives me a value and what I
need is the whole waveform as an output variable. I've tried every
variety of syntax I could think of (or find in the manual) but still
no luck. Can anyone help?

Thanks
 
On 4 Jun 2004 16:44:30 -0700, paul_gg@teehan.ca (Paul) wrote:

If am measuring something, as follows:

.MEASURE energy INTEGRAL PAR='P(a) + P(b)' FROM=1ns TO=2ns

The stuff I'm integrating is a function of various instantaneous
powers from my test circuit. I am trying to write a script that will
allow me to re-use a series of .MEASURE statements similar to the one
above, but I can't quite get the syntax right. I'm not that
experienced so maybe what I'm trying to do is not even possible...

Basically what I want to do is replace the stuff in the PAR field
above with a parameter that I can define elsewhere. Like this:
.MEASURE energy INTEGRAL powers FROM....
with powers defined:
.PARAM powers='P(a) + P(b)', but that doesn't work, so I tried
.MEASURE powers PARAM='P(a) + P(b)
The latter ran successfully but it only gives me a value and what I
need is the whole waveform as an output variable. I've tried every
variety of syntax I could think of (or find in the manual) but still
no luck. Can anyone help?

Thanks
Can't you do that with a built-in macro or one of your own in the post
processor. In PSpice Probe you certainly can.

...Jim Thompson
--
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |

I love to cook with wine. Sometimes I even put it in the food.
 
Jim Thompson <thegreatone@example.com> wrote in message news:<hm72c0d9s85rt7k0n68lmpfs1t6bo75cjn@4ax.com>...
On 4 Jun 2004 16:44:30 -0700, paul_gg@teehan.ca (Paul) wrote:

If am measuring something, as follows:

.MEASURE energy INTEGRAL PAR='P(a) + P(b)' FROM=1ns TO=2ns

The stuff I'm integrating is a function of various instantaneous
powers from my test circuit. I am trying to write a script that will
allow me to re-use a series of .MEASURE statements similar to the one
above, but I can't quite get the syntax right. I'm not that
experienced so maybe what I'm trying to do is not even possible...

Basically what I want to do is replace the stuff in the PAR field
above with a parameter that I can define elsewhere. Like this:
.MEASURE energy INTEGRAL powers FROM....
with powers defined:
.PARAM powers='P(a) + P(b)', but that doesn't work, so I tried
.MEASURE powers PARAM='P(a) + P(b)
The latter ran successfully but it only gives me a value and what I
need is the whole waveform as an output variable. I've tried every
variety of syntax I could think of (or find in the manual) but still
no luck. Can anyone help?

Thanks

Can't you do that with a built-in macro or one of your own in the post
processor. In PSpice Probe you certainly can.

...Jim Thompson

I'm not sure I understand. In the waveform viewer I could certainly
do all kinds of calculations, but this is not what I want to do
because it is too time-consuming and I have a ton of trials to run.
If I can get hspice to work as I've said then I feed it an input file
with all my data and get an output file with all my measurements.
 
On 4 Jun 2004 16:44:30 -0700, paul_gg@teehan.ca (Paul) wrote:

I hope my response below starts a discussion on this.

If am measuring something, as follows:

.MEASURE energy INTEGRAL PAR='P(a) + P(b)' FROM=1ns TO=2ns

The stuff I'm integrating is a function of various instantaneous
powers from my test circuit. I am trying to write a script that will
allow me to re-use a series of .MEASURE statements similar to the one
above, but I can't quite get the syntax right. I'm not that
experienced so maybe what I'm trying to do is not even possible...

Basically what I want to do is replace the stuff in the PAR field
above with a parameter that I can define elsewhere. Like this:
.MEASURE energy INTEGRAL powers FROM....
with powers defined:
.PARAM powers='P(a) + P(b)', but that doesn't work, so I tried
.MEASURE powers PARAM='P(a) + P(b)
The latter ran successfully but it only gives me a value and what I
need is the whole waveform as an output variable. I've tried every
variety of syntax I could think of (or find in the manual) but still
no luck. Can anyone help?

Thanks

I've had some small successes in using measures in both hspice and
smartspice, but am far from an expert. The syntax is slightly
different between the programs which adds to the confusion.

I've had the fewest problems when I do things sequentially and don't
try to do too much in a single statement. For instance, this set up a
series of ave measures (in smartspice) for sequential intervals on a
waveform in smartspice:


.param t = '2/550000'
.param t0 = 39
.param k1 = 2
.param k2 = 10

.measure tran voaven08 avg v(vo) from= '(t0+k1 + 0*k2)*t' to '(t0+k2
+ 0*k2)*t'
.measure tran voaven07 avg v(vo) from= '(t0+k1 + 1*k2)*t' to '(t0+k2
+ 1*k2)*t'
.measure tran voaven06 avg v(vo) from= '(t0+k1 + 2*k2)*t' to '(t0+k2
+ 2*k2)*t'
.measure tran voaven05 avg v(vo) from= '(t0+k1 + 3*k2)*t' to '(t0+k2
+ 3*k2)*t'
.measure tran voaven04 avg v(vo) from= '(t0+k1 + 4*k2)*t' to '(t0+k2
+ 4*k2)*t'
.measure tran voaven03 avg v(vo) from= '(t0+k1 + 5*k2)*t' to '(t0+k2
+ 5*k2)*t'
.measure tran voaven02 avg v(vo) from= '(t0+k1 + 6*k2)*t' to '(t0+k2
+ 6*k2)*t'
.measure tran voaven01 avg v(vo) from= '(t0+k1 + 7*k2)*t' to '(t0+k2
+ 7*k2)*t'
.measure tran voaven00 avg v(vo) from= '(t0+k1 + 8*k2)*t' to '(t0+k2
+ 8*k2)*t'
.measure tran voavep01 avg v(vo) from= '(t0+k1 + 9*k2)*t' to '(t0+k2
+ 9*k2)*t'
.measure tran voavep02 avg v(vo) from= '(t0+k1 +10*k2)*t' to '(t0+k2
+10*k2)*t'
.measure tran voavep03 avg v(vo) from= '(t0+k1 +11*k2)*t' to '(t0+k2
+11*k2)*t'
.measure tran voavep04 avg v(vo) from= '(t0+k1 +12*k2)*t' to '(t0+k2
+12*k2)*t'
.measure tran voavep05 avg v(vo) from= '(t0+k1 +13*k2)*t' to '(t0+k2
+13*k2)*t'
.measure tran voavep06 avg v(vo) from= '(t0+k1 +14*k2)*t' to '(t0+k2
+14*k2)*t'
.measure tran voavep07 avg v(vo) from= '(t0+k1 +15*k2)*t' to '(t0+k2
+15*k2)*t'
.measure tran voavep08 avg v(vo) from= '(t0+k1 +16*k2)*t' to '(t0+k2
+16*k2)*t'

Once you have determined the measures, you can think of them as
variables containing values. You can then do algebra with them with
another type of measure statement:

************************
from the hspice manual:

..measure <DC|TRAN|AC> result PARAM='equation'
+ <goal=val> <MINVAL = val>


Then you've created another set of variables based on the original
..measure variables. You had this working.

************************
Here's another set of measures for frequency and duty cycle from
smartspice. It was used to characterize the startup characteristics
of an oscillator:

..measure tran t18up when v(out)=0.9 rise=1 td=18u

.measure tran t18pw delay v(out) val=0.9 td=18u rise=1
+ targ v(out) val=0.9 fall=1

.measure tran t18pr delay v(out) val=0.9 td=18u rise=1
+ targ v(out) val=0.9 rise=2

.measure tran freq18 expr VAL="1/t18pr"
.measure tran duty18 expr VAL="100*t18pw/t18pr"

You see (at least in smartspice) the expr VAL syntax can be used for
algebra once the original measures are available.

*****************

I haven't had much luck yet creating continuous plots of the .measure
outputs. I was recently told by smartspice support that I needed to
add:

..options savemfiles

to save the values off for plotting in smartview. I haven't tried
this yet.

In hspice, there seems to be a similar

..options measout

that might be useful for plotting.

This is where I stop right now. If anyone is an expert on .measures,
please educate me.

Hope any of this helps. Let me know if you figure it out.

The .measures are wonderful for data reduction since they don't
require the "touch labor" of using a gui. If I can figure out how to
use them properly I may have to do a lot less copying and pasting into
a spreadsheet.

Regards,
Larry
 
On 7 Jun 2004 08:28:03 -0700, paul_gg@teehan.ca (Paul) wrote:

Jim Thompson <thegreatone@example.com> wrote in message news:<hm72c0d9s85rt7k0n68lmpfs1t6bo75cjn@4ax.com>...
On 4 Jun 2004 16:44:30 -0700, paul_gg@teehan.ca (Paul) wrote:

If am measuring something, as follows:

.MEASURE energy INTEGRAL PAR='P(a) + P(b)' FROM=1ns TO=2ns

The stuff I'm integrating is a function of various instantaneous
powers from my test circuit. I am trying to write a script that will
allow me to re-use a series of .MEASURE statements similar to the one
above, but I can't quite get the syntax right. I'm not that
experienced so maybe what I'm trying to do is not even possible...

Basically what I want to do is replace the stuff in the PAR field
above with a parameter that I can define elsewhere. Like this:
.MEASURE energy INTEGRAL powers FROM....
with powers defined:
.PARAM powers='P(a) + P(b)', but that doesn't work, so I tried
.MEASURE powers PARAM='P(a) + P(b)
The latter ran successfully but it only gives me a value and what I
need is the whole waveform as an output variable. I've tried every
variety of syntax I could think of (or find in the manual) but still
no luck. Can anyone help?

Thanks

Can't you do that with a built-in macro or one of your own in the post
processor. In PSpice Probe you certainly can.

...Jim Thompson


I'm not sure I understand. In the waveform viewer I could certainly
do all kinds of calculations, but this is not what I want to do
because it is too time-consuming and I have a ton of trials to run.
If I can get hspice to work as I've said then I feed it an input file
with all my data and get an output file with all my measurements.
In PSpice you'd just declare your own macro, then "Insert",
"Waveform", "MacroName(x,y,z)"

...Jim Thompson
--
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |

I love to cook with wine. Sometimes I even put it in the food.
 
(snip)
.measure tran t18up when v(out)=0.9 rise=1 td=18u

.measure tran t18pw delay v(out) val=0.9 td=18u rise=1
+ targ v(out) val=0.9 fall=1

.measure tran t18pr delay v(out) val=0.9 td=18u rise=1
+ targ v(out) val=0.9 rise=2

.measure tran freq18 expr VAL="1/t18pr"
.measure tran duty18 expr VAL="100*t18pw/t18pr"

You see (at least in smartspice) the expr VAL syntax can be used for
algebra once the original measures are available.

(snip)
The .measures are wonderful for data reduction since they don't
require the "touch labor" of using a gui. If I can figure out how to
use them properly I may have to do a lot less copying and pasting into
a spreadsheet.

I think hspice and smartspice syntax are different enough


Regards,
Larry
THere are obviously syntax differences between hspice and smartspice
but I think I see what you were doing. One thing I'm wondering is
your expr VAL statement - does that work if you want your previous
measurement (like t18pr) to be an output variable? That's the problem
I'm having... a .MEASURE statement will always produce a single
number, not a waveform over which I could integrate.

For example I can do this successfully:
..MEASURE result INTEGRAL PAR="v(a) + v(b)"....
but not this:
..MEASURE result INTEGRAL PAR=some_parameter
..MEASURE some_parameter = PARAM("v(a) + v(b)")
But it seems like I should be able to. Like the syntax for what I'm
trying to do is there but I just can't find it.

Jim, I'm using hspice with avanwaves for post-processing and I don't
know if there's a way for me to do what you suggest. In any case I
don't think that approach will solve my problem - precisely as Larry
indicated, I would like to avoid the "touch labor" of the gui. In any
case the question is becoming somewhat academic for me since I've
managed to complete my current task by hacking together a Perl script
(though I am not very good at Perl). Now it's mostly curiosity left.
:)

Thanks
- Paul
 
On 10 Jun 2004 14:16:02 -0700, paul_gg@teehan.ca (Paul) wrote:

(snip)
.measure tran t18up when v(out)=0.9 rise=1 td=18u

.measure tran t18pw delay v(out) val=0.9 td=18u rise=1
+ targ v(out) val=0.9 fall=1

.measure tran t18pr delay v(out) val=0.9 td=18u rise=1
+ targ v(out) val=0.9 rise=2

.measure tran freq18 expr VAL="1/t18pr"
.measure tran duty18 expr VAL="100*t18pw/t18pr"

You see (at least in smartspice) the expr VAL syntax can be used for
algebra once the original measures are available.

(snip)
The .measures are wonderful for data reduction since they don't
require the "touch labor" of using a gui. If I can figure out how to
use them properly I may have to do a lot less copying and pasting into
a spreadsheet.

I think hspice and smartspice syntax are different enough


Regards,
Larry

THere are obviously syntax differences between hspice and smartspice
but I think I see what you were doing. One thing I'm wondering is
your expr VAL statement - does that work if you want your previous
measurement (like t18pr) to be an output variable? That's the problem
I'm having... a .MEASURE statement will always produce a single
number, not a waveform over which I could integrate.
I've yet to figure out how to get consecutive measures to plot in a
single graph. I just print out the single value for each, then enter
it into a spreadsheet. It's a nuisance.


For example I can do this successfully:
.MEASURE result INTEGRAL PAR="v(a) + v(b)"....
I would think it would result in a single number over the entire
interval. You haven't specified a "from or "to" to define a smaller
period. I've never read where a measure can be used to produce a
continuous integral or derivative curve. Perhaps someone knows for
sure? I'd be tempted to break up the measures into several smaller
segments, then hope to plot the numbers in a curve. The more
intervals, the better the approximation. You could then do math on
the segments. Other than that I don't have an idea of how to approach
this.

but not this:
.MEASURE result INTEGRAL PAR=some_parameter
.MEASURE some_parameter = PARAM("v(a) + v(b)")
But it seems like I should be able to. Like the syntax for what I'm
trying to do is there but I just can't find it.

btw, I've been trading emails with simetrix and it appears they don't
do measures, but instead have a programming language to automate
simulations. It seems pretty powerful if you're a programmer.

Regards,
Larry
 
ldg <ldg@ix.netcom.com> wrote in message news:<i5jkc0p1f7c43fs41tfrbgf4uq8lq4vsh5@4ax.com>...
On 10 Jun 2004 14:16:02 -0700, paul_gg@teehan.ca (Paul) wrote:

(snip)
.measure tran t18up when v(out)=0.9 rise=1 td=18u

.measure tran t18pw delay v(out) val=0.9 td=18u rise=1
+ targ v(out) val=0.9 fall=1

.measure tran t18pr delay v(out) val=0.9 td=18u rise=1
+ targ v(out) val=0.9 rise=2

.measure tran freq18 expr VAL="1/t18pr"
.measure tran duty18 expr VAL="100*t18pw/t18pr"

You see (at least in smartspice) the expr VAL syntax can be used for
algebra once the original measures are available.

(snip)
The .measures are wonderful for data reduction since they don't
require the "touch labor" of using a gui. If I can figure out how to
use them properly I may have to do a lot less copying and pasting into
a spreadsheet.

I think hspice and smartspice syntax are different enough


Regards,
Larry

THere are obviously syntax differences between hspice and smartspice
but I think I see what you were doing. One thing I'm wondering is
your expr VAL statement - does that work if you want your previous
measurement (like t18pr) to be an output variable? That's the problem
I'm having... a .MEASURE statement will always produce a single
number, not a waveform over which I could integrate.

I've yet to figure out how to get consecutive measures to plot in a
single graph. I just print out the single value for each, then enter
it into a spreadsheet. It's a nuisance.



For example I can do this successfully:
.MEASURE result INTEGRAL PAR="v(a) + v(b)"....

I would think it would result in a single number over the entire
interval. You haven't specified a "from or "to" to define a smaller
period. I've never read where a measure can be used to produce a
continuous integral or derivative curve. Perhaps someone knows for
sure? I'd be tempted to break up the measures into several smaller
segments, then hope to plot the numbers in a curve. The more
intervals, the better the approximation. You could then do math on
the segments. Other than that I don't have an idea of how to approach
this.

but not this:
.MEASURE result INTEGRAL PAR=some_parameter
.MEASURE some_parameter = PARAM("v(a) + v(b)")
But it seems like I should be able to. Like the syntax for what I'm
trying to do is there but I just can't find it.


btw, I've been trading emails with simetrix and it appears they don't
do measures, but instead have a programming language to automate
simulations. It seems pretty powerful if you're a programmer.

Regards,
Larry

My mistake, I left off the FROM and TO stuff out of laziness. That's
what the "..." was for. I suppose I should have left that in.

In fact producing a continuous INTEGRAL measurement is not my intent;
the final result is a number over a specific interval and that's what
I want. The only trouble is the intermediate step where I want to
define what I'm integrating over in a parameter. I assumed you could
do it with a .MEASURE or a .PARAM but couldn't get either of those
working.
 

Welcome to EDABoard.com

Sponsor

Back
Top