Simulation: Measuring with .meas

Hello,
how to measure in Kicad NGSPice. I tried adding " .meas tran test1 AVG V(/OUT) " to a textfield, but it’s not executed.
Can somebody help? Maybe @holger ?

On KiCad 8:

Spice simulator window, after a transient simulation: Right click onto the signal in the Signal list to the right–>choose measurement type, read result in the Measurement/Value list.

On the Eeschema canvas, use a .control section in a text box:

.control
set controlswait
meas tran test1 AVG V(/OUT)
.endc

Command ‘meas’ without a dot! Read the result in the console window. From…to… may be given, as any other statement described in the ngspice manual, chapter 15.4.

1 Like

That answered my quesiton, holger, thank you!

May I have a feedback on ngspice? The notation at the moment is very scientific. Is there an option (maybe in the control section?) to get “engineering uints”? Say 5.96V? Or 1mSec? That would make my brain think faster =)

average_output_voltage= 5.965101e+00 from= 0.000000e+00 to= 1.000000e-03

I have been playing with KiCAD simulations. If somebody is interested in my work, i share the files here publicly.

I have a question regarding time measurements using the command “meas tran oscillation_periode TRIG V(/OUT) VAL=0.5 RISE=10 TARG v(/OUT) VAL=0.5 RISE=11”. Is there a way to continue calculation with variables, e.g. if i want to use oscillation_periode to be converted into frequency?

@holger is there a simple solution?

Yes, there is.

With its measurement (inside of a .control section) a vector (ngspice nomenclature) named oscillation_periode is created, which then may be used as any vector in the ngspice control language. There is a tutorial on the control language available at ngspice control language tutorial.

An eample input file (standard ngspice) with an oscillator and 2 methods to measure its frequency in a .control section is attached.
RO_B3_meas_si.sp (1.2 KB)