From MAILER-DAEMON Mon Sep 05 09:27:10 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bgtva-0001ed-MU for mharc-help-gnucap@gnu.org; Mon, 05 Sep 2016 09:27:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgtvZ-0001eV-7e for help-gnucap@gnu.org; Mon, 05 Sep 2016 09:27:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgtvV-0004uo-1V for help-gnucap@gnu.org; Mon, 05 Sep 2016 09:27:08 -0400 Received: from violet.upc.es ([147.83.2.51]:56979) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgtvU-0004uG-MH for help-gnucap@gnu.org; Mon, 05 Sep 2016 09:27:04 -0400 Received: from tscserver.upc.edu (tscserver.upc.edu [147.83.91.196]) by violet.upc.es (8.14.1/8.13.1) with ESMTP id u85D1TYT017432 for ; Mon, 5 Sep 2016 15:01:29 +0200 Received: from oersted.localnet (oersted.upc.es [147.83.106.135]) by tscserver.upc.edu (Postfix) with ESMTP id 241B03280075 for ; Mon, 5 Sep 2016 15:01:29 +0200 (CEST) From: Orestes Mas To: help-gnucap@gnu.org Date: Mon, 05 Sep 2016 15:01:29 +0200 Message-ID: <2548745.h2acQ8l8Xa@oersted> Organization: UPC User-Agent: KMail/5.1.3 (Linux/4.4.0-36-generic; KDE/5.23.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-Mail-Scanned: Criba 2.0 + Clamd X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.4.3 (violet.upc.es [147.83.2.51]); Mon, 05 Sep 2016 15:01:59 +0200 (CEST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 147.83.2.51 Subject: [Help-gnucap] Finding voltage between nodes X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2016 13:27:10 -0000 Hello, Is there any simple way to find the voltage between two arbitrary nodes? By now I can achieve it doing: gnucap> store op v(nodes) gnucap> op gnucap> measure va=at(probe="v(2)") gnucap> measure vb=at(probe="v(5)") gnucap> eval va-vb But I consider this a bit cumbersome, specially the "measure" sentences. Orestes. From MAILER-DAEMON Mon Sep 05 09:43:12 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bguB6-0000Rw-5d for mharc-help-gnucap@gnu.org; Mon, 05 Sep 2016 09:43:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bguB4-0000Qh-65 for help-gnucap@gnu.org; Mon, 05 Sep 2016 09:43:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bguB1-0000Ml-0Y for help-gnucap@gnu.org; Mon, 05 Sep 2016 09:43:10 -0400 Received: from 11.freeelectron.net ([74.208.209.19]:36860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bguB0-0000LZ-Rs for help-gnucap@gnu.org; Mon, 05 Sep 2016 09:43:06 -0400 Received: from 24-148-98-11.ip.mhcable.com ([24.148.98.11] helo=floyd.freeelectron.net) by 11.freeelectron.net with esmtp (Exim 4.80) (envelope-from ) id 1bguAr-00040d-SP for help-gnucap@gnu.org; Mon, 05 Sep 2016 08:42:58 -0500 Date: Mon, 5 Sep 2016 09:42:52 -0400 From: al davis To: help-gnucap@gnu.org Message-ID: <20160905094252.5283d826@floyd.freeelectron.net> In-Reply-To: <2548745.h2acQ8l8Xa@oersted> References: <2548745.h2acQ8l8Xa@oersted> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 74.208.209.19 Subject: Re: [Help-gnucap] Finding voltage between nodes X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2016 13:43:11 -0000 On Mon, 05 Sep 2016 15:01:29 +0200 Orestes Mas wrote: > Is there any simple way to find the voltage between two arbitrary nodes? The easiest way is to put a component in the circuit, and ask for its voltage. Or .. there is probably one there already. Iprobe (4 5) 0 .print op v(Iprobe) To store it .. .store op v(Iprobe) From MAILER-DAEMON Tue Sep 13 08:04:14 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bjmRi-0007TR-6D for mharc-help-gnucap@gnu.org; Tue, 13 Sep 2016 08:04:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjmRg-0007SJ-2O for Help-gnucap@gnu.org; Tue, 13 Sep 2016 08:04:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjmRc-0007pF-SI for Help-gnucap@gnu.org; Tue, 13 Sep 2016 08:04:11 -0400 Received: from teparybean2.exetel.com.au ([220.233.0.94]:38677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjmRc-0007m1-Gt for Help-gnucap@gnu.org; Tue, 13 Sep 2016 08:04:08 -0400 Received: from 210.104.233.220.static.exetel.com.au ([220.233.104.210] helo=[10.0.8.3]) by teparybean2.exetel.com.au with esmtpa (Exim 4.84) (envelope-from ) id 1bjmRS-00045w-5W for Help-gnucap@gnu.org; Tue, 13 Sep 2016 22:03:58 +1000 X-Vipre-Scanned: 01932FA300CC36019330F0-TDI To: Help-gnucap@gnu.org From: Richard Gipps Message-ID: <57D7EB27.5010102@gipps.id.au> Date: Tue, 13 Sep 2016 22:03:51 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 220.233.0.94 Subject: [Help-gnucap] Oscillator Simulation X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 12:04:13 -0000 Hi, I am trying to simulate an oscillator circuit. When I run the simulation I get the following response: gnucap -b oscillator.cir Gnucap 2009.12.07 RCS 26.136 ... oscillator.cir # 27. #Time zero time step newtime=1.000000e-12 rejectedtime=1.000000e-12 oldtime=0.000000e+00 non-recoverable user requested newtime=1.000000e-12 rejectedtime=2.000000e-12 oldtime=1.000000e-12 using=2.000000e-12 tried everything, still doesn't work, giving up I have tried the circuit with ngspice and it works fine. The file is shown below: oscillator.cir * 100MHz Oscillator * This oscillator takes about 100us to reach steady state. * The charge displacement through each capacitor is 170pC p-p * 0.01radians = 0.16% = 16ps @ 100MHz .param start_print = 100.01u .param stop_time = 100.15u .MODEL q2SC3357_v13_M NPN +(IS=684.2e-18 BF=161.1 NF=1.0 VAF=51 + IKF=574.6e-3 BR=10.71 NR=1.0 VAR=2.1 + IKR=28.05e-3 ISE=1.0e-18 NE=1.193 ISC=6.211e-18 + NC=1.1 RB=3.0 IRB=75.9e-5 RBM=1.0 + RE=2.67 RC=3.5 CJE=1.847e-12 VJE=1.014 + MJE=464.8e-3 CJC=1.086e-12 VJC=617.4e-3 MJC=353.8e-3 + XCJC=0.1 CJS=0 VJS=0.75 MJS=0 + FC=0.50 TF=23e-12 XTF=0.39 VTF=0.668 + ITF=0.06 TR=0 PTF=20 EG=1.11 + XTI=3.0 XTB=0) VCC 10 0 PULSE(0 8) Vb 2 0 DC 4.78 Q1 1 2 3 q2SC3357_v13_M IC 3 0 DC 10m L1 10 1 120n C1 1 3 21.14p C2 3 0 15.48n .OP .TRAN 1p {stop_time} {start_print} 1p .PRINT TRAN V(1) .END Any ideas? Richard. From MAILER-DAEMON Tue Sep 13 08:38:26 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bjmyo-0002rD-Qa for mharc-help-gnucap@gnu.org; Tue, 13 Sep 2016 08:38:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjmym-0002pC-1P for help-gnucap@gnu.org; Tue, 13 Sep 2016 08:38:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjmyk-0001EK-65 for help-gnucap@gnu.org; Tue, 13 Sep 2016 08:38:22 -0400 Received: from rip.d-labs.de ([2a01:4f8:d15:2cc8::2]:54960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjmyj-0000xZ-WF for help-gnucap@gnu.org; Tue, 13 Sep 2016 08:38:22 -0400 Received: from felix by rip.d-labs.de with local (Exim 4.84_2) (envelope-from ) id 1bjmyG-0007O2-C3; Tue, 13 Sep 2016 14:37:52 +0200 Date: Tue, 13 Sep 2016 14:37:52 +0200 From: Felix Salfelder To: Richard Gipps Cc: help-gnucap@gnu.org Message-ID: <20160913123752.GD735@rip.d-labs.de> References: <57D7EB27.5010102@gipps.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57D7EB27.5010102@gipps.id.au> User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2a01:4f8:d15:2cc8::2 Subject: Re: [Help-gnucap] Oscillator Simulation X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 12:38:25 -0000 Hi Richard On Tue, Sep 13, 2016 at 10:03:51PM +1000, Richard Gipps wrote: > VCC 10 0 PULSE(0 8) there seems to be a problem with the time zero value of that pulse try "VCC 10 0 PULSE(0 8 1p)" instead. maybe "(0 8 0 1p)". (not sure if this is a bug or a feature. spice implements some guessing around zero-time transitions...) > .OP the tran command will care of that. there should be no difference if you leave it out. > .TRAN 1p {stop_time} {start_print} 1p > .PRINT TRAN V(1) in gnucap, the .print command actually attaches probes to the circuit. after the simulation it's too late. but i think, generally, you can run a simulation, attach probes, then continue. maybe you want to try this instead .TRAN 0 {start_print} {start_print/10} .print tran v(nodes) v(VCC) .TRAN {stop_time} trace=a have fun felix From MAILER-DAEMON Tue Sep 13 08:47:25 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bjn7V-0005DA-Cy for mharc-help-gnucap@gnu.org; Tue, 13 Sep 2016 08:47:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjn7S-0005Cb-Cz for Help-gnucap@gnu.org; Tue, 13 Sep 2016 08:47:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjn7Q-0005dI-B6 for Help-gnucap@gnu.org; Tue, 13 Sep 2016 08:47:21 -0400 Received: from rip.d-labs.de ([2a01:4f8:d15:2cc8::2]:54975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjn7Q-0005d0-50 for Help-gnucap@gnu.org; Tue, 13 Sep 2016 08:47:20 -0400 Received: from felix by rip.d-labs.de with local (Exim 4.84_2) (envelope-from ) id 1bjn7P-0007cC-4F; Tue, 13 Sep 2016 14:47:19 +0200 Date: Tue, 13 Sep 2016 14:47:19 +0200 From: Felix Salfelder To: Richard Gipps Cc: Help-gnucap@gnu.org Message-ID: <20160913124719.GE735@rip.d-labs.de> References: <57D7EB27.5010102@gipps.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57D7EB27.5010102@gipps.id.au> User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2a01:4f8:d15:2cc8::2 Subject: Re: [Help-gnucap] Oscillator Simulation, addendum X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 12:47:23 -0000 On Tue, Sep 13, 2016 at 10:03:51PM +1000, Richard Gipps wrote: > gnucap -b oscillator.cir > Gnucap 2009.12.07 RCS 26.136 i am unsure if it will make a difference for your particular circuit, yet that is quite an old version. see [1] for current development. cheers felix [1] http://savannah.gnu.org/git/?group=gnucap From MAILER-DAEMON Wed Sep 14 08:35:36 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bk9Pc-00029w-Gq for mharc-help-gnucap@gnu.org; Wed, 14 Sep 2016 08:35:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bk9PW-00024p-UB for help-gnucap@gnu.org; Wed, 14 Sep 2016 08:35:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bk9PQ-00033i-B8 for help-gnucap@gnu.org; Wed, 14 Sep 2016 08:35:29 -0400 Received: from teparybean2.exetel.com.au ([220.233.0.94]:54547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bk9PQ-00032j-0F for help-gnucap@gnu.org; Wed, 14 Sep 2016 08:35:24 -0400 Received: from 210.104.233.220.static.exetel.com.au ([220.233.104.210] helo=[10.0.8.3]) by teparybean2.exetel.com.au with esmtpa (Exim 4.84) (envelope-from ) id 1bk9PE-0001SV-Aj for help-gnucap@gnu.org; Wed, 14 Sep 2016 22:35:12 +1000 X-Vipre-Scanned: 0039839200CC50003984DF-TDI To: help-gnucap@gnu.org References: <57D7EB27.5010102@gipps.id.au> <20160913123752.GD735@rip.d-labs.de> From: Richard Gipps Message-ID: <57D943F9.8030506@gipps.id.au> Date: Wed, 14 Sep 2016 22:35:05 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160913123752.GD735@rip.d-labs.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 220.233.0.94 Subject: Re: [Help-gnucap] Oscillator Simulation X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 12:35:34 -0000 Hi Felix, On 13/09/16 10:37 PM, Felix Salfelder wrote: >there seems to be a problem with the time zero value of that pulse >try "VCC 10 0 PULSE(0 8 1p)" instead. maybe "(0 8 0 1p)". >(not sure if this is a bug or a feature. spice implements some guessing >around zero-time transitions...) Both of these options worked. Thanks! Thank you for your other tips too. Regarding the version, I am running the latest version in the FreeBSD package collection. If I run into problems with this old version I may need to try and compile the newer one. Richard. From MAILER-DAEMON Wed Sep 14 11:11:50 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bkBqo-0003vd-9f for mharc-help-gnucap@gnu.org; Wed, 14 Sep 2016 11:11:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkBqm-0003ub-Q6 for Help-gnucap@gnu.org; Wed, 14 Sep 2016 11:11:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkBqj-0003YE-66 for Help-gnucap@gnu.org; Wed, 14 Sep 2016 11:11:48 -0400 Received: from 11.freeelectron.net ([74.208.209.19]:46168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkBqj-0003UN-1Y for Help-gnucap@gnu.org; Wed, 14 Sep 2016 11:11:45 -0400 Received: from 24-148-98-11.ip.mhcable.com ([24.148.98.11] helo=floyd.freeelectron.net) by 11.freeelectron.net with esmtp (Exim 4.80) (envelope-from ) id 1bkBqX-00061w-Q8; Wed, 14 Sep 2016 10:11:33 -0500 Date: Wed, 14 Sep 2016 11:11:27 -0400 From: al davis To: Richard Gipps Cc: Help-gnucap@gnu.org Message-ID: <20160914111127.54ca7e71@floyd.freeelectron.net> In-Reply-To: <57D7EB27.5010102@gipps.id.au> References: <57D7EB27.5010102@gipps.id.au> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 74.208.209.19 Subject: Re: [Help-gnucap] Oscillator Simulation X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 15:11:49 -0000 On Tue, 13 Sep 2016 22:03:51 +1000 Richard Gipps wrote: > Gnucap 2009.12.07 RCS 26.136 > zero time step > newtime=1.000000e-12 rejectedtime=1.000000e-12 oldtime=0.000000e+00 > non-recoverable user requested > newtime=1.000000e-12 rejectedtime=2.000000e-12 oldtime=1.000000e-12 > using=2.000000e-12 > tried everything, still doesn't work, giving up > > .TRAN 1p {stop_time} {start_print} 1p > > .PRINT TRAN V(1) My first impression was that you are using a 8 year old version that had a bug in time step control that would occasionally show a convergence failure in mid-transient, when there was really nothing wrong. But that's not the issue here. The bug is that it gave you a useless error message. The problem is that you specified a time strobe of 1 ps, and an option set "dtmin" to 1 ps. On startup, it tries an internal time step even smaller than that, which is too small per the option. Time steps less than dtmin are considered to be zero, hence the message "zero time step". The solution to the problem is either to specify a smaller dtmin, or bigger time strobe. Given the choice, the better solution is to specify a bigger time strobe. I have never seen a case where an analysis really needed a 1 picosecond (1e-12) time step, but then there are circuits in the terahertz range that I haven't seen. For a circuit operating at 100 MHz (f=1e8, period=1e-8) this is 10000 x oversampled. When you oversample this much, it actually becomes less accurate due to rounding. What Felix said in another post is good advise. From MAILER-DAEMON Wed Sep 14 11:57:45 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bkCZF-0005sn-9a for mharc-help-gnucap@gnu.org; Wed, 14 Sep 2016 11:57:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkCZC-0005pn-0H for help-gnucap@gnu.org; Wed, 14 Sep 2016 11:57:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkCZ8-00012l-1d for help-gnucap@gnu.org; Wed, 14 Sep 2016 11:57:40 -0400 Received: from 11.freeelectron.net ([74.208.209.19]:53557) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkCZ7-00012f-Sz for help-gnucap@gnu.org; Wed, 14 Sep 2016 11:57:37 -0400 Received: from 24-148-98-11.ip.mhcable.com ([24.148.98.11] helo=floyd.freeelectron.net) by 11.freeelectron.net with esmtp (Exim 4.80) (envelope-from ) id 1bkCYz-00063K-Qc; Wed, 14 Sep 2016 10:57:29 -0500 Date: Wed, 14 Sep 2016 11:57:24 -0400 From: al davis To: Felix Salfelder Cc: Richard Gipps , help-gnucap@gnu.org Message-ID: <20160914115724.1f0341f5@floyd.freeelectron.net> In-Reply-To: <20160913123752.GD735@rip.d-labs.de> References: <57D7EB27.5010102@gipps.id.au> <20160913123752.GD735@rip.d-labs.de> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 74.208.209.19 Subject: Re: [Help-gnucap] Oscillator Simulation X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 15:57:43 -0000 On Tue, 13 Sep 2016 14:37:52 +0200 Felix Salfelder wrote: > On Tue, Sep 13, 2016 at 10:03:51PM +1000, Richard Gipps wrote: > > VCC 10 0 PULSE(0 8) > > there seems to be a problem with the time zero value of that pulse > try "VCC 10 0 PULSE(0 8 1p)" instead. maybe "(0 8 0 1p)". > (not sure if this is a bug or a feature. spice implements some guessing > around zero-time transitions...) It's a bug .. In two places in bm_pulse.cc EVAL_BM_PULSE::tr_eval, ">=" should be ">". (lines "falling" and "rising") It is intended to mimic the Spice pulse, therefore it should work the way Spice does. But that's not "The Problem" here. It does explain why gnucap and spice give a different starting point. There is another hidden issue here, something I have been working on. As originally stated, rise=fall=delay=0, there is nothing in the circuit to hint at what time stepping to start with, so the automated step control would miss the oscillation. In the original, the requested step of 1ps was a hint, but otherwise with what Felix suggested, it would have skipped by the oscillation. You might call this a "bug" but most other simulators are worse. By giving a finite rise time, the simulator now has some basis to figure out time stepping and can go from there. You just need something, somewhere, that somehow requests a step size less then the expected period of the oscillator. > > .OP > > the tran command will care of that. ... when time starts at zero. When time does not start at zero, it most likely will continue from the previous run. This is a difference from Spice (a feature). Spice always starts at zero, but may hide the time leading up to the time you ask for. > there should be no difference if you > leave it out. Putting it in makes it happen twice. Use OP when you want more data, or before an AC analysis. > > > .TRAN 1p {stop_time} {start_print} 1p > > .PRINT TRAN V(1) See my other email about the "1p" step size. > in gnucap, the .print command actually attaches probes to the circuit. > after the simulation it's too late. but i think, generally, you can run > a simulation, attach probes, then continue. Yes .. I do it all the time. My comments following explain what Felix did, and why. > maybe you want to try this instead > > .TRAN 0 {start_print} {start_print/10} Start at zero, up to {start_print} with minimal output, only 10 steps will be printed. Gnucap will determine what internal step size is needed. > .print tran v(nodes) v(VCC) adds the probes for what you want to see. > .TRAN {stop_time} trace=a This line continues the transient analysis from where the previous one ended. "trace=a" (I prefer "trace all") shows all time steps, which are often unevenly spaced. You didn't say anything about accuracy, but I will ... The default tolerances are often not good enough for detailed work on oscillators. It is tempting to manually specify smaller steps, but that is not a good idea. Tighten the tolerances, especially "trtol". I like trtol=1 for this. It will run slower, but that's ok if it provides the accuracy you need. Another thing that will improve accuracy is to connect the output of the oscillator to the input of a switch, (S device) with a switch voltage at the middle of the oscillator swing. This creates a "cross event" which will let you accurately measure the period and frequency of the oscillator, to the specified tolerance. If you do this, it should be accurate enough for the fourier command to measure distortion. Check out the "measure" command for measuring frequency, etc. From MAILER-DAEMON Wed Sep 21 09:46:41 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bmhrF-0002wu-D7 for mharc-help-gnucap@gnu.org; Wed, 21 Sep 2016 09:46:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmhrD-0002uP-C9 for Help-gnucap@gnu.org; Wed, 21 Sep 2016 09:46:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmhr9-00011t-8u for Help-gnucap@gnu.org; Wed, 21 Sep 2016 09:46:38 -0400 Received: from teparybean.exetel.com.au ([220.233.0.93]:54054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmhr8-00010o-UX for Help-gnucap@gnu.org; Wed, 21 Sep 2016 09:46:35 -0400 Received: from 210.104.233.220.static.exetel.com.au ([220.233.104.210] helo=[10.0.8.3]) by teparybean.exetel.com.au with esmtpa (Exim 4.84) (envelope-from ) id 1bmhr1-0003Az-P7 for Help-gnucap@gnu.org; Wed, 21 Sep 2016 23:46:27 +1000 X-Vipre-Scanned: 0649473800CCFA06494885-TDI To: Help-gnucap@gnu.org References: <57D7EB27.5010102@gipps.id.au> <20160913123752.GD735@rip.d-labs.de> <20160914115724.1f0341f5@floyd.freeelectron.net> From: Richard Gipps Message-ID: <57E28F27.304@gipps.id.au> Date: Wed, 21 Sep 2016 23:46:15 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160914115724.1f0341f5@floyd.freeelectron.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 220.233.0.93 Subject: Re: [Help-gnucap] Oscillator Simulation X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2016 13:46:40 -0000 Hi Al, Sorry for the delay in responding. Thanks for the additional information On 15/09/16 1:57 AM, al davis wrote: > There is another hidden issue here, something I have been working on. > As originally stated, rise=fall=delay=0, there is nothing in the > circuit to hint at what time stepping to start with, so the automated > step control would miss the oscillation. In the original, the > requested step of 1ps was a hint, but otherwise with what Felix > suggested, it would have skipped by the oscillation. You might call > this a "bug" but most other simulators are worse. By giving a finite > rise time, the simulator now has some basis to figure out time > stepping and can go from there. You just need something, somewhere, > that somehow requests a step size less then the expected period of the > oscillator. ngspice behaves differently with the statement VCC 10 0 PULSE(0 8), it uses the step time by default when not explicitly specified. 1ps is a very small time step for a 100MHz oscillator. I am injecting a current pulse into the oscillator and measuring the phase shift in the signal. I need to measure down to 0.01 radians. I was experimenting with ngspice with different step times but the phase shifts I was observing were not sensible. Now I have a better understanding on how to use GNUCap I can repeat the experiments using it. Richard. From MAILER-DAEMON Wed Sep 21 21:31:52 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bmsrg-0000M0-Q1 for mharc-help-gnucap@gnu.org; Wed, 21 Sep 2016 21:31:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmsrd-0000LT-W1 for help-gnucap@gnu.org; Wed, 21 Sep 2016 21:31:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmsrZ-0006eC-P5 for help-gnucap@gnu.org; Wed, 21 Sep 2016 21:31:48 -0400 Received: from 11.freeelectron.net ([74.208.209.19]:37827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmsrZ-0006d0-Hw for help-gnucap@gnu.org; Wed, 21 Sep 2016 21:31:45 -0400 Received: from 24-148-98-11.ip.mhcable.com ([24.148.98.11] helo=floyd.freeelectron.net) by 11.freeelectron.net with esmtp (Exim 4.80) (envelope-from ) id 1bmsrP-0007tW-Gb for help-gnucap@gnu.org; Wed, 21 Sep 2016 20:31:35 -0500 Date: Wed, 21 Sep 2016 21:31:29 -0400 From: al davis To: help-gnucap@gnu.org Message-ID: <20160921213129.2ff01cf9@floyd.freeelectron.net> In-Reply-To: <57E28F27.304@gipps.id.au> References: <57D7EB27.5010102@gipps.id.au> <20160913123752.GD735@rip.d-labs.de> <20160914115724.1f0341f5@floyd.freeelectron.net> <57E28F27.304@gipps.id.au> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 74.208.209.19 Subject: Re: [Help-gnucap] Oscillator Simulation X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 01:31:51 -0000 On Wed, 21 Sep 2016 23:46:15 +1000 Richard Gipps wrote: > On 15/09/16 1:57 AM, al davis wrote: > > There is another hidden issue here, something I have been working on. > > As originally stated, rise=fall=delay=0, there is nothing in the > > circuit to hint at what time stepping to start with, so the automated > > step control would miss the oscillation. In the original, the > > requested step of 1ps was a hint, but otherwise with what Felix > > suggested, it would have skipped by the oscillation. You might call > > this a "bug" but most other simulators are worse. By giving a finite > > rise time, the simulator now has some basis to figure out time > > stepping and can go from there. You just need something, somewhere, > > that somehow requests a step size less then the expected period of the > > oscillator. > ngspice behaves differently with the statement VCC 10 0 PULSE(0 8), it > uses the step time by default when not explicitly specified. There is a bug in the gnucap pulse, the ">=" relationship where it should be ">", that shows only when delay, rise, and fall are all zero, causing the zero time value to be the pulse value not the initial value in this case. It's fixed in the current "unstable" branch. Using the step time by default is really an artifact of the algorithm. The actual step size for the first step is not known until after the initial DC has already been computed. A user specified, on the tran line, step size is usually not needed or desirable. By the algorithm, user specified "strobe" is optional in gnucap. It has been a syntax requirement, now being removed, because it was for Spice. It actually works best to specify it unreasonably big, and use "trace all" to see all of the steps. This syntax requirement is being changed to allow (and encourage) just specifying start and stop, no step or strobe, while maintaining compatibility. It's in the "transient-3" branch. Looking again at what Felix suggested ... >> maybe you want to try this instead >> .TRAN 0 {start_print} {start_print/10} This is a strobe at {start_print/10}. That is, 10 steps on the whole startup interval. You wouldn't want this for the pulse rise time! It's really to run with suppressed output, that may take a while, but give you some hint that something is actually happening. > 1ps is a very small time step for a 100MHz oscillator. I am injecting a > current pulse into the oscillator and measuring the phase shift in the > signal. I need to measure down to 0.01 radians. I was experimenting with > ngspice with different step times but the phase shifts I was observing > were not sensible. You need to look at the tolerance settings. 0.01 radians is .00159 cycles. 628.3 samples in a cycle. You need a little more than that, call it 1000 x oversampling, near the measurement points, not necessarily everywhere else. 1ps is 10000 x oversampled. 10x better than you need, but that in itself is not a problem. With default tolerances, accuracy will be nowhere near good enough, even with the oversampling. Default reltol is .001. Strictly this should be good enough, but practically it isn't. You are measuring to .00159, so reltol alone will use up most of your error tolerance, assuming that it works perfectly. Approximations are never perfect. Try reltol=.0001, or smaller. Also look at vntol and abstol. This is for convergence tolerance. I haven't gotten to step control yet. One way to check whether it is good enough is to tighten or loosen the tolerance. If the results change significantly, it's not good enough. The definition of "significantly" depends on what you want. Either you need to tighten or you have gone too far and are seeing rounding errors. For rounding errors, look at floor, vfloor, and roundofftol. It may have reached the hardware limit. Now on to step control ... By specifying strobe and dtmax of 1p, you are in effect disabling the automatic step control. One quick check of whether you are getting good results is to change (half or double) the step size and see if the results change. Again, if results change significantly, it's wrong. It is probably better to use the step control. Then you need to look at some other options, especially trtol. The default value is 7, for Spice compatibility, which is certainly wrong for this. It says that time control tolerances are this much worse than convergence tolerances. So, trtol=7 and reltol=.001 means step control is based on .007. This is, alone, worse than your accuracy requirement. Try trtol=1. Also check chgtol. Still, step control is based on the "y" axis, mostly voltage and charge, If you want to measure phase errors, you also need to control it the other way, the "x" axis, time. This is why I suggested adding a switch to your circuit, to sense the time of a crossing. That way it too will be accuracy controlled to the specified tolerances. Now look at what steps you are getting. Try half and double the tolerances and see what changes. With all this about tightening tolerances, you can use loose tolerances to get by the start-up. Then tighten and continue. There is an oscillator example on the wiki .... http://gnucap.org/dokuwiki/doku.php?id=gnucap:manual:examples:phase_shift_oscillator Also .. more recent versions of gnucap .. The current "unstable" branch has a fix for the "<=" bug, and lots of other improvements. You might want to try the experimental "transient-3" branch, which has some changes that I hope are improvements in the transient analysis. http://git.savannah.gnu.org/cgit/gnucap.git This has been a good example for me to work on step control. I have made some refinements to how it handles the first few steps. Here is what the oscillator has evolved to: ============================================ oscillator.cir * 100MHz Oscillator * This oscillator takes about 100us to reach steady state. * The charge displacement through each capacitor is 170pC p-p * 0.01radians = 0.16% = 16ps @ 100MHz .param start_print = 100.u .param stop_time = 100.15u .MODEL q2SC3357_v13_M NPN +(IS=684.2e-18 BF=161.1 NF=1.0 VAF=51 + IKF=574.6e-3 BR=10.71 NR=1.0 VAR=2.1 + IKR=28.05e-3 ISE=1.0e-18 NE=1.193 ISC=6.211e-18 + NC=1.1 RB=3.0 IRB=75.9e-5 RBM=1.0 + RE=2.67 RC=3.5 CJE=1.847e-12 VJE=1.014 + MJE=464.8e-3 CJC=1.086e-12 VJC=617.4e-3 MJC=353.8e-3 + XCJC=0.1 CJS=0 VJS=0.75 MJS=0 + FC=0.50 TF=23e-12 XTF=0.39 VTF=0.668 + ITF=0.06 TR=0 PTF=20 EG=1.11 + XTI=3.0 XTB=0) VCC 10 0 PULSE(0 8) Vb 2 0 DC 4.78 Q1 1 2 3 q2SC3357_v13_M IC 3 0 DC 10m L1 10 1 120n C1 1 3 21.14p C2 3 0 15.48n .model cross sw vt=7 S1 (0 0 1 0) cross .store tran v(nodes) .print tran v(nodes) charge(c?) .opt reltol=.01 .TRAN start=0 stop={start_print} strobe={start_print/5} .opt trtol=1 reltol=.000001 numdgt=9 .TRAN stop={stop_time} strobe=0 .measure t2=cross("v(1)", cross=7, rise, last) .measure t1=cross("v(1)", cross=7, rise, last, before=t2) .param period={t2-t1} .eval period .param frequency={1/(t2-t1)} .eval frequency .print fourier v(1) .fourier 0 {frequency*10} {frequency/2} .fourier 0 {frequency*10} {frequency} .status .END From MAILER-DAEMON Thu Sep 22 09:22:36 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bn3xU-00076N-Ne for mharc-help-gnucap@gnu.org; Thu, 22 Sep 2016 09:22:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn3xO-00070q-W8 for help-gnucap@gnu.org; Thu, 22 Sep 2016 09:22:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn3xI-0003GJ-Vr for help-gnucap@gnu.org; Thu, 22 Sep 2016 09:22:29 -0400 Received: from teparybean.exetel.com.au ([220.233.0.93]:42146) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn3xI-0003El-L2 for help-gnucap@gnu.org; Thu, 22 Sep 2016 09:22:24 -0400 Received: from 210.104.233.220.static.exetel.com.au ([220.233.104.210] helo=[10.0.8.3]) by teparybean.exetel.com.au with esmtpa (Exim 4.84) (envelope-from ) id 1bn3x9-0002KS-Mz for help-gnucap@gnu.org; Thu, 22 Sep 2016 23:22:15 +1000 X-Vipre-Scanned: 0B5975DA00CD100B597727-TDI To: help-gnucap@gnu.org References: <57D7EB27.5010102@gipps.id.au> <20160913123752.GD735@rip.d-labs.de> <20160914115724.1f0341f5@floyd.freeelectron.net> <57E28F27.304@gipps.id.au> <20160921213129.2ff01cf9@floyd.freeelectron.net> From: Richard Gipps Message-ID: <57E3DAF9.6050701@gipps.id.au> Date: Thu, 22 Sep 2016 23:22:01 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160921213129.2ff01cf9@floyd.freeelectron.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 220.233.0.93 Subject: Re: [Help-gnucap] Oscillator Simulation X-BeenThere: help-gnucap@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Users help list for gnucap." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 13:22:35 -0000 Hi Al, Thanks for your detailed response. I appreciate the effort you have put into this. On 22/09/16 11:31 AM, al davis wrote: > http://git.savannah.gnu.org/cgit/gnucap.git I have downloaded this version and I am working on compiling it for Windows. Will report back once I have it working. Richard.