From b714f0bea9cf99cdc397a065fedf89a4d5f26657 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 13 Dec 2021 14:54:57 +0100 Subject: [PATCH] Add other integration methods to the example We have: meas, integ, and code model INTEG --- examples/various/integrate1.cir | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/examples/various/integrate1.cir b/examples/various/integrate1.cir index 98629d265..decc96a37 100644 --- a/examples/various/integrate1.cir +++ b/examples/various/integrate1.cir @@ -1,21 +1,33 @@ -Test of integ +Demonstrate the ngspice integration methods +* function interg +* meas ... ... INTEG +* code model INTEG i1 0 1 1 R1 1 2 1 -C1 2 3 1 ic=0 +C1 2 3 1 Vm1 3 0 0 +.ic v(2) = 0 v2 11 0 dc 0 sin (0 1 2) v3 31 0 dc 0 pulse (0 1 0.1 0.1 0.1 0.1 0.6) +* integrate during transient simulation +V4 in 0 dc 0 pwl (0 0 1 1) +aint in out int_in +.model int_in int(in_offset=0.0 gain=1.0 ++ out_lower_limit=-1e12 out_upper_limit=1e12 ++ limit_range=1e-9 out_ic=0.0) + .tran 0.01 1 .control run display -let int1 = integ(Vm1#branch) +* integrate after the simulation +let int1 = integ(Vm1#branch) plot int1 v(2) let int2 = integ(v(11)) @@ -24,5 +36,9 @@ plot v(11) int2 let int3 = integ(v(31)) plot v(31) int3 +plot in out +* get the integral value of a vector section +meas tran yint INTEG v(out) from=0.4 to=0.6 + .endc .end