4 posts / 0 new
Last post
#1 Mar 18, 2020
NordCAD_MartinBusk
Offline
Last seen: 3 weeks 3 days ago
Joined: 2020-03-05 07:08

Limitations of measurements

Location

Nordcad Systems A/S
Vesterå Aalborg
Denmark
DK

Hello PSpice community,

I have been having trouble making a desired measurement parameter.

Let me try to explain briefly: I have a charging- and a discharging curve of the voltage across my resistor which is connected to a capacitor (thus making the charging curves later mentioned). I also have a DC voltage called "threshold". 

I want to measure the time (I'm doing a transient analysis) between the charging curve crossing the threshold voltage, until the discharging curve crosses the threshold voltage again.

I'm trying to use the "XatNthY" measurement for this.

I fill out the measurement like this: "XatNthY(V(R1:2),V(Threshold),2) - XatNthY(V(R1:2),V(Threshold),1)", which gives me the x-value for the second time the voltage across my resistor crosses the threshold voltage, minus the first time. This is what I'm interested in.

It should work, but it does not. It gives wrong result. When I replace "V(Threshold)" with the actual voltage value 2.6, I get the correct result. (I tested if V(Threshold) had the correct value by pressing it into measurement expressions. 2.600000 it said, so should be good)

The problem is that I want to change the value of V(Threshold) often, and I would prefer not to have to put in the hardcoded value into the measurement every time I do so. 

 

So my question is: Is there any way to make a variable, which can be put into the mentioned measurement, or is it strictly for hardcoded values? A collegue told me he once saw a guy in a PSpice course do something to implement a variable in measurements, but he does not remember how. So my initial thought is that it should be possible somehow, I just haven't managed to find it.

 

Thank you in advance for your replies and stay safe out there!

 

Sat, 2020-03-21 00:16
spice_up_your_c...
Offline
Last seen: 3 weeks 2 days ago
Joined: 2020-01-26 09:49

Hi,

I was in a similar situation sometime back when I was working on a filter design. My aim was to measure the stopband depth everytime based on its measurement expression where cut off frequency would be a variable in the expression. But, I couldn't find a way to make that possible. I had to check the value manually after running simulation each time.

If someone has a suggestion on this, please advise  

Thu, 2020-03-26 08:22 (Reply to #2)
NordCAD_MartinBusk
Offline
Last seen: 3 weeks 3 days ago
Joined: 2020-03-05 07:08

Hello,

It discourages me that you too have not been able to find a solution to this. 

I recently noticed that one can implement MatLab functions in PSpice measurements (if ones company has a MatLab license of course).

I think this might make it possible to use variables in measurements, but I cant confirm it.

Tue, 2020-03-31 04:26 (Reply to #3)
NordCAD_MartinBusk
Offline
Last seen: 3 weeks 3 days ago
Joined: 2020-03-05 07:08

Hi,

I'm glade to announce that a collegue of mine gave me some help on this matter. I'll post the measurement syntax below:

TimeAboveTrsh(1,2)=x3-x2
*
*#Desc#* Find the value of X corresponding to the difference between
*#Desc#* the second and first crossings of a threshold value.
*
*#Arg1#* Name of the Threshold trace, must be constant
*#Arg2#* Name of the trace to measure
*
{
      1| search forward max !1 ;
      2| search forward for level (y1) !2
         search forward /x2/ for level (y1) !3 ;
}

 

In argument (1) you put a constant value or another measurement expression

The way I use it is with a MAX(V(treshold)) in the first argument. This way you make the value constant, as MAX() returns a constant, but it varies if you change the value of V(treshold), thus removing the need to change the value in PSpice for each simulation.

In argument (2) you put your trace.

I tested it out and it works just like I want it to. I used a DC voltage supply as my treshold, and measured the time (in a transient analysis) in which the voltage from my pulse voltage supplier was higher then the DC threshold. 
This was precicely what I was looking for. I hope it can help someone else in here.

/Martin

Download PSpice and try it for free! Download Free Trial
Cadence