Plotting step'd value of AC simulation and meas error

I am implementing a very simple impedance measurement to test different devices.
The technique works a single bias and frequency. The .meas statements correctly report the R and C I expect. But when I add a step command on the bias, it says “Warning: Trouble parsing .meas c -1/(x*{omega})”. Does anyone know why?
When I add more than one frequency to run the simulation, it executes the measurement statements without error. But, when I plot the measurement results, it isn’t clear for what frequency the data is being plotted. In this example, C is independent of frequency, but my other devices to test will not be.
It possible to get the frequency the simulator is using in a particular simulation (when I am stepping through frequencies)? If so, I could add frequency dependence to the cap to test this function.

CV-Bench2.qsch (2.8 KB)

Several recommendations:

• Frequency and Freq are reserved word, not suggest to define as parameter (In Qspice Help > Waveform Viewer > Waveform Expressions, you can find reserved words e.g. E, Freq, Frequency, J, K, NAN, PI, Q, TEMP, TIME). Try not to re-define them in .param to prevent error.
• Use .func and can run result from .ac directly. In the plot, you can simply switch the scale from logarithmic to linear and disable the phase to plot the real value of Rser() and Cser()
• In this example, the x-axis represents frequency. If you want the x-axis to represent bias, you can modify the “.step” command to : `.step param Vrb 0 1 0.1 param frq list 1K 10K`

CV-Bench(.step).qsch (2.7 KB)

Thanks so much. Some follow-ups:

1. Why do you think .meas C -1/(X*{omega}) was failing to parse? I tried modifying it to .meas AC Cx param -1/(X*omega) and other ways, and nothing works. It clearly has something to do with my use of the omega parameter. When I use 2*pi*frq instead, it works. I’ve tried every way of using curly braces without any affect. Something similar happens when I try to use the omega parameter in the .func calculating capacitance.
2. How did you get the ticks on the plot of capacitance? The tick box is grayed out for me, and I’ve changed the lower and upper limits too.

I didn’t test it yet, if you add .option SaveParam can help?
For linear scale, click log and make sure nothing is selected, and now you get linear scale with tag

1. When I use .option SaveParam, it says “Fatal error: .step doesn’t work when the number of nodes changes(from 11 to 9).

2. And I believe I am doing that, but not sure what you mean by “make sure nothing is selected”. It still looks like my image above.

Point 2: Don’t select anything. Click on “dB” or “Log” until it not selected, this represent “Lin” (linear) scale.

Mike explained that Omega is a keyword in .alias in .qraw data file.
Here is the method that you can resolve .meas c warning.

1. not to use freq, omega in .param
2. add .option SaveParam - if you have a .param with function or call another .param, and with .meas uses, possibly you may need this option

But even you do that, this setup is still not a treated as a stepped simulation, as .ac list is a single point simulation, and for single point simulation (e.g. .op, .ac list), their first step directive is not treated as stepped and .meas will only return one dataset.

In short, I still recommend you consider the .func method I provided before.

CV-Bench2.qsch (2.9 KB)

Thanks again. I am using `.ac dec 3 1k 100k`
Should I file a bug report for

1. the .ac list not being treated as stepped simulation
2. introducing .option SaveParam results in Simulation reporting `Fatal error: .step doesn't work when the number of nodes changes(from 11 to 9). Sorry about the inconvenience.`

#1 : Initially, I also misunderstood a single point analysis with .step not treated as stepped simulation as a bug until I got a reply from Mike. Actually, this is what Qspice handle a single point simulation.
Think about this example, if Qspice handle this single point analysis (.ac list) as stepped for first .step loop (i.e. step param C…), you will get multiple lines with x-axis at frequency 1kHz. But instead, you now get C as x-axis as you know this is tested at 1kHz. If single point analysis (.op and .ac list) treat first .step as stepped, the multiple line plot of each with a single point of data will not be visually useful.

#2 : Actually, I didn’t see this error. Which simulation file generate this error?

below is an example if a single point simulation with .step, but treated as stepped.
If you really need your setup to use .meas, may be you can set .ac list with two very close frequency like this, as this change single point simulation to multiple points simulation, and first .step will be treated as stepped.

Maybe I could explain what I’m actually trying to do. I’m trying to examine spice models of FETs to see how well they line up with my semiconductor device textbook. One characteristic is the capacitance vs gate bias curve:

Testing the BSC070N10NS5 as as first example, using the `.func` statements to get the information, I do see a shift in capacitance, but not exactly like the textbook. One difference from theoretical is the lack of frequency dependence, and also the capacitance steps very abruptly and in the opposite direction with forward bias:

Regarding the discussion above: the `.meas` statements are subject to what you say

" .ac list is a single point simulation, and for single point simulation (e.g. .op, .ac list), their first step directive is not treated as stepped and .meas will only return one dataset."

Indeed, I only see a single value for each `.meas` at each frequency, while my intent was to have a `.meas` result for each bias at each frequency. You explain that

" if Qspice handle this single point analysis (.ac list) as stepped for first .step loop (i.e. step param C…), you will get multiple lines with x-axis at frequency 1kHz. But instead, you now get C as x-axis as you know this is tested at 1kHz. If single point analysis (.op and .ac list) treat first .step as stepped, the multiple line plot of each with a single point of data will not be visually useful."

But, again, the plot from the textbook is what I would reproduce, and that is visually useful: a family of curves of different frequencies. Does the explanation of my intent change your understanding at all?

I believe I understand now. While the `param frq` is indeed going through the list in the `.step` command, for each `.ac` simulation, it only sees `.ac list frq`, or a single frequency. And while this is what I intended, I’m not sure why the `.meas` evaluations don’t all get saved. See below for the effect of `.option SaveParam`. I guess the `meas` evaluations don’t all get saved because the scope of the `meas` is within a single ac sim?

To further pursue my intent, and to test if there is something fundamentally different about `.ac list` compared to `.ac dec`, it would intuitive if the following worked:

Is there a way to get the frequency the simulator is using for a particular run? Then I could replace `frq` in the `.meas` and `.func` commands.

While using the results of the `.func ` statements seem to be what I need, the results differ from the theoretical textbook curve. I can test other devices to see if another model more closely resembles theory.

As soon as I add the .option SaveParam (whether this is still relevant or not), I get this message:

In short, you want to measure Ciss with gate voltage with DC level from negative to positive?

Yes, essentially, and hopefully corroborating basic device physics in the process.

Normally, in MOSFET datasheet, it provides Ciss, Coss and Crss vs Vds with Vgs @ 0V.
I cannot recall I see this plot with Vgs change from negative to positive at a certain Vds condition.

How that textbook suggest the MOSFET should be tested to get that curve. But from the description, it test a p-type substrate MOS… Here I am testing a VDMOS n-channel model by modifying my template which can test those parameters. (How to make tests circuits for typical characteristics for a mosfet? - QSPICE - Qorvo Tech Forum)

Here is a test for a p-channel VDMOS model. If you assign a negative sign to Vgs (x-axis), it will produce a curve similar to the one in your textbook plot. However, I do not observe the low-frequency effects compared to the screenshot from your textbook. I am uncertain if other MOSFET models would exhibit that behavior, as it is beyond my area of expertise. There are many MOSFET model level and not sure your textbook is talking about high-power MOSFET or CMOS characteristic.

Thank you very much for linking those other threads. I knew this was a loaded topic haha. I’m realizing the CV behavior in the textbook plot is expected only for a normal lateral MOSFET, and vertical power mosfets have a different construction. I have enough information now to keep me busy before I can ask another question.

1 Like