Commit Graph

6333 Commits

Author SHA1 Message Date
Brian Taylor 2d3f5f8f70 With the ngspice gnuplot command, enable x/y contour plots for 2d Cider save file data. Usage: gnuplot <file> xycontour <expr>. xycontour is a new flag which is ignored if the plot data is not from 2d Cider. For contours, only a single plotarg <expr> is allowed. With <expr1> vs <expr2>, only <expr1> is plotted and <expr2> is ignored. 2021-10-30 11:13:11 +02:00
Holger Vogt 83ce95a38b remove some compiler warnings 2021-10-26 16:27:54 +02:00
Holger Vogt 2719c71d78 Fix a bug in optran code:
devname will be used in the list of instances
2021-10-26 11:39:18 +02:00
dwarning ade90bd6eb correct some scaling rules 2021-10-24 18:11:39 +02:00
dwarning 751549967a save few calculation effort in diode load routine 2021-10-23 23:00:27 +02:00
dwarning c77a1873fd save few calculation effort in bjt load routine 2021-10-23 13:55:37 +02:00
dwarning b17f4c4eeb prevent unwanted fallthrough 2021-10-23 13:55:15 +02:00
dwarning 66d7f30de9 correct scaling for IBC parameter 2021-10-23 13:54:49 +02:00
dwarning 78d2d3a36b correct temp update for IBE and IBC parameter 2021-10-23 13:54:26 +02:00
dwarning 8f285544a9 introduce IBE and IBC model parameter for more accurate current calculation 2021-10-23 13:53:58 +02:00
dwarning 925f401cb7 remove comment regarding ancient leakage current defaults 2021-10-23 13:53:36 +02:00
dwarning 33669b01db c2 and c4 are now aliases for B-E and B-C leakage saturation currents 2021-10-23 13:52:59 +02:00
Holger Vogt 2437326897 A check to avoid multiple entries for the same node into the .save list
Scan the data base dbs (list of saves) before a new entry is generated.
2021-10-20 22:16:36 +02:00
Holger Vogt 9a791c7487 save within subcircuit
enable V(a,b) as v(a) v(b)
2021-10-20 20:06:31 +02:00
Holger Vogt 1fdab4357c F.-request 85: save currents in subcircuits
Separate handling .ic/.nodeset and .save .
Add i(Vxx) to  address translation.
Vxx#branch is not supported.
2021-10-20 13:56:43 +02:00
Holger Vogt b4e5a7a721 Feature request 85: Enable .save within subcircuits
inp.c: Add .save to wl_first only after subcircuit expansion
subckt.c: treat .save like .ic
2021-10-19 11:44:47 +02:00
Holger Vogt aa32a84e7f remove compiler warnings 2021-10-11 17:11:45 +02:00
Holger Vogt 8bfdaf0b25 Make optran standrad by calling com_optran during ngspice initialization. 2021-10-10 11:41:28 +02:00
Holger Vogt d5129a5ad5 if step size in optran command is set to 0,
optran is deselected.
2021-10-10 11:40:53 +02:00
Holger Vogt 46c7b5269f remove optran command from spinit 2021-10-10 11:40:00 +02:00
Holger Vogt 86201a85a2 Redo the transformation vswitch -> pswitch
Parsing takes default values into account, when
parameter is missing.
S vswitch --> pswitch code model
S_ST vswitch (with hysreresis) --> SW switch
S iswitch --> aswitch code model
S_ST iswitch (with hysreresis) --> CSW switch

Use string handling for replacements: allow parameter
equations in .model lines.
2021-10-09 23:20:34 +02:00
Holger Vogt a41cbad50e Revert "Redo the transformation vswitch -> pswitch"
This reverts commit b78bb48ead.
2021-10-08 20:34:59 +02:00
Holger Vogt b78bb48ead Redo the transformation vswitch -> pswitch
Parsing takes defaults into account
S switch --> pswitch code model
S_ST switch (with hysreresis) --> SW switch

iswitch not yet done
2021-10-06 23:58:03 +02:00
Holger Vogt e5ca96b039 Improved error message:
when argument out of range, name the term
2021-10-06 23:53:41 +02:00
Holger Vogt d6307122ff Pswitch: Fix a bug in resistance calculation when cntl_on < cntl_off
Correct setting of parens
2021-10-06 23:52:37 +02:00
Holger Vogt ce693efa67 Revert "Revert "Neew pswitch with patch 0001-pswitch-fix.patch from Jube 3rd, 21 at""
This reverts commit 1f03335230.
2021-10-06 23:17:39 +02:00
Holger Vogt 1f03335230 Revert "Neew pswitch with patch 0001-pswitch-fix.patch from Jube 3rd, 21 at"
This reverts commit d36fcaf34c.
2021-10-06 23:11:49 +02:00
Holger Vogt 01280a8a6e There is no f (femto or Farad) in a resistor line 2021-10-05 18:10:54 +02:00
Holger Vogt 0cfd634423 is_a_modelname() to detect a model 1N4148, if compt LT is set.
Rewrite is_a_modelname(), when LT is set: only check element lines
beginning with r and c for RKM notation of a number.

So don't use a RKM number (e.g. 4k7) for naming a resistor model.
2021-10-05 18:10:45 +02:00
Holger Vogt 4e56176e13 bug 497: Prevent a crash in CPL
Forbiddeb combination of model parameters.
Details are not yet available.
2021-10-03 18:41:30 +02:00
Holger Vogt 8019e69baa Update to Garbage Collector for cpl
Update some comments
Insert the deleting functions
Reset pool_vi and ndn_btree
Add an example with 20 call to cpl in sequence
2021-10-03 15:58:51 +02:00
Holger Vogt 756318f794 No more meory leaks with existing cpl examples:
Add cpldelete.c and cplmdel.c
Delete the model parameters.
Add 2 missing memsaved().
2021-10-03 15:58:37 +02:00
Holger Vogt e3cdb676e1 Issue a warnong only when ngdebug is set. 2021-10-03 15:58:06 +02:00
Holger Vogt d27c5b1796 Add memsaved() to TMALLOC, calloc and replace CPLTFREE for tfree 2021-10-03 15:57:30 +02:00
Holger Vogt 2edad6da01 Add memsaved or memdelete to macros 2021-10-03 15:57:09 +02:00
Holger Vogt 50d1e7101d Re-format cplsetup.c 2021-10-03 15:56:47 +02:00
Holger Vogt 8af3f7a5de Add memsaved() to TMALLOC 2021-10-03 15:56:28 +02:00
Holger Vogt d8c18559ff Each TMALLOC is accompanied by fcn memsaved(). 2021-10-03 15:56:15 +02:00
Holger Vogt 795d32652a Add mem_init() and mem_delete() to setup and unsetup functions 2021-10-03 15:55:57 +02:00
Holger Vogt a986bc8f9d Add header with extern function prototypes 2021-10-03 15:55:22 +02:00
Holger Vogt 640bef9249 Update intro text 2021-10-03 15:54:58 +02:00
Holger Vogt ffd9890946 Add missing function nghash_delete_special(),
developed for branch gc-local
2021-10-03 15:54:20 +02:00
Holger Vogt 48736e3623 add missing headers 2021-10-03 15:53:50 +02:00
Holger Vogt 9f0e9ad02b hash functions for cpl garbage collector 2021-10-03 15:53:02 +02:00
Holger Vogt e1e97a4822 Revert "Revert ".control and `B' parser, fix precedence of '-' versus '^'""
This reverts commit adc1546e59.
2021-10-03 15:51:42 +02:00
Holger Vogt ab92983684 Rename the capacitor and inductor code models to capacitoric and inductoric
8e4db9109 ("adms bsimbulk and bsimcmg implementation based on work from Robert Larice", 2020-12-17)
changed inptypelk.c, line 37 from strcmp to strcasecmp.
Thus Capacitor (model for C) and code model capacitor are no longer
distinguished. Model parsing for the code models fails.

These code models are used very infrequently, thus renaming them
is a valid fix.
2021-09-29 23:14:05 +02:00
Holger Vogt 22a878e49e RKM for C: Revert reading f, it is again femto
Examples files include expected results
2021-09-27 17:56:12 +02:00
Holger Vogt 4bb1d84f9f Update to RKM if ngbehavior=lt is set:
Reading C and R values follow the RKM convention with 2 exceptions:

    Upper case and lower case letters are not distinguished.

    Letters m, M denote milli (1e-3), letters Meg or meg denote 1e6.
2021-09-27 16:42:26 +02:00
Holger Vogt d922ca5ae6 Remove double assigment to s[1]
Assignment Is either done in the loop or by *y = '\0';
2021-09-26 00:05:30 +02:00
Holger Vogt 32e26a5849 Enable RKM notation for R and C, when ngbehavior LT is selected.
Add 2 evaluation functions specific for R and C respectively.
R has code letters L, R, K, M, G, T enabled. M here is Meg!
C has code letters p, n, u or µ, m, F. F here is unity, femto is
not available, m is still milli!
Two examples files show all cases.
2021-09-25 23:50:35 +02:00
Holger Vogt 189126c029 When checking for µ, truncated the line, when shifted.
Enable R470, when newcompat LT is selected.
2021-09-25 23:43:36 +02:00
Holger Vogt 83a9d48638 ngspice input deck may contain special characters like µ (mu).
Detect mu for ANSI and UTF-8 and translate it to u.
2021-09-25 13:50:16 +02:00
Holger Vogt 39defa3fa7 XSPICE d_source: prevent a crash when the input file is not found 2021-09-24 14:08:47 +02:00
Holger Vogt b24be62bf0 prevent crash if info.node_table has not been defined,
caused by some preceding error.
2021-09-22 16:19:37 +02:00
Holger Vogt fd8ec3977b Make 'speedcheck' also available in batch mode simulation. 2021-09-19 23:02:00 +02:00
Holger Vogt a77377f6c1 command listing: add option r (runable)
listing r > $inputdir/mycirc_runable.cir
will save the expanded netlist without line numbers,
ready to be sourced again and run in ngspice.
2021-09-18 14:57:22 +02:00
Keno Fischer 0654a78681 Add missing rule for ngicon.rc 2021-09-17 16:29:57 +02:00
Holger Vogt 6b12971fc6 Revert "Reading CIDER "Device Cross Section" failed if written in ASCII."
This reverts commit 4a907749a6.
2021-09-17 15:00:48 +02:00
Brian Taylor 2ebed3f747 Use the current point number as the single digit index for Cider 2D ascii save files. This conforms to the normal usage with other types of ascii rawfile. The numd parser table entry for ic.file now has the correct IF_STRING type. 2021-09-17 14:59:54 +02:00
Holger Vogt a93bed0f4b Fix bug #557
Revise memory allocation for different analysis types
2021-09-17 12:10:35 +02:00
Holger Vogt 372bd64f34 Check V and I lines for dc and ac.
Allow ac without parameters, a default is set to ac ( 1 0 )
2021-09-14 17:15:25 +02:00
Holger Vogt adc1546e59 Revert ".control and `B' parser, fix precedence of '-' versus '^'"
This reverts commit b32ae9f79b.
2021-09-14 14:14:29 +02:00
Brian Taylor d6c88b0e9a Retaining the mixed case of Cider quoted string valued parameters. Limit searches for ic.file to D*, M*, and Q* device instantiation lines. Cider model (numos, numd, nbjt) detection is limited to .model lines. Continuation lines which do contain these tokens are not checked, but this should rarely happen. All of the examples/cider circuits meet these assumptions. Memory errors have been removed. 2021-09-10 11:50:22 +02:00
Holger Vogt f0ffff2dc0 re-enable lower-casing of tokens beginning with 'cd',
except for command 'cd' which is usually followed by a space.
2021-09-07 12:42:20 +02:00
Holger Vogt 532eddde54 make PTparse error message more verbose:
include point in a line where parsing failed.
2021-09-07 12:41:18 +02:00
Holger Vogt 4a907749a6 Reading CIDER "Device Cross Section" failed if written in ASCII.
Second point count flag enabled (for CIDER 2D only).
2021-09-06 23:00:10 +02:00
Brian Taylor 64686132ad Don't search for ic.file within comments. 2021-09-05 11:28:27 +02:00
Brian Taylor 5a8f07a292 Do not use non-portable strcasestr. 2021-09-05 11:27:56 +02:00
Brian Taylor 43520d9b8a Fix NAN error in numd2 area report and crashes when a doping file is missing. Update examples/cider so that the test circuits all run; add case sensitivity tests for rootfile and ic.file parameter strings enclosed in a single pair of double quotes. 2021-09-05 11:27:01 +02:00
Holger Vogt 5cd919ebc1 Add resistance sweep error message for failing optran 2021-09-03 15:01:53 +02:00
Holger Vogt c61b95f1e7 Optran may throw an error message while in temp sweep
and optran fails: message added (in addition prevent a crash)
2021-09-03 10:18:58 +02:00
Holger Vogt bb23520bd4 errno needs to be nulled in Linux.
Its previous value will be returned after checking.
2021-09-01 23:16:58 +02:00
Holger Vogt 04cdfb6bb9 'Option interp' and command 'stop' have been incompatible.
Allow both in a run.
Issue note (however not checked) that stop time data have to fit
the inpolated times.
2021-09-01 12:26:49 +02:00
Holger Vogt ce0559b458 prevent a crash, e.g. when incompatible 'option interp'
is set and 'stop' is called.
2021-09-01 10:57:27 +02:00
Holger Vogt b9c5873606 command 'wrnodev'
Write current node voltages to file in format .ic=value
The file may be used to set initial conditions for another simulation,
e.g. ac at a specific time step of a transient simulation.
2021-08-30 14:47:10 +02:00
Holger Vogt 7d13fe8214 Add a line feed to make message more readable. 2021-08-29 14:28:27 +02:00
Holger Vogt 6e7993b289 ASRC (B-Source) error message is cryptic, as it does not tell
which B-Source failed.
Add a hint to the ASRC error message on the name of the
B-Source instance.
2021-08-29 14:27:56 +02:00
Holger Vogt de1024a75b Prevent a crash if command 'save n1' has been given on a digital node n1.
Improved error message.
2021-08-28 15:09:51 +02:00
Holger Vogt 8e9a14678c Revise the SOA and add new parameters:
pd_max id_max idr_max te_max rth_ext derating
rth_ext is currently not used
2021-08-27 18:20:16 +02:00
Holger Vogt 79ebf219fe Add a check for sys/sysctrl.h, which has been declared deprecated,
and which may not be available (in the future) on some systems.
2021-08-25 11:48:21 +02:00
Holger Vogt 1b17c5cc59 VDMOS, prepare SOA with new parameters
Model parameters pd_max, id_max, idr_max, and te_max
(power dissipated, drain current, drain reverse current, temperature)
2021-08-24 17:52:33 +02:00
Holger Vogt 5758d58349 spinit: add optran to the standard inits 2021-08-24 17:48:17 +02:00
Holger Vogt c8d76014b9 SOA for bipolar
Replace pow_max by pd_max
2021-08-24 16:15:46 +02:00
Holger Vogt 10b2f96ed1 Enable command 'optran' in spinit or .spiceinit,
when the circuit is not yet loaded.
Then the optran data are stored in static variables,
until optran is called again with arg NULL from inp.c,
to set the data in ft_curckt->ci_defTask.
2021-08-24 15:53:31 +02:00
Holger Vogt 0f46f9b228 List definition needs spaces between ( and next token,
and between token and )

Update to comment.
2021-08-24 15:51:09 +02:00
Holger Vogt a3973c7fe0 optran is only selected when the 'optran' command has been processed.
If not, the call to the OPtran() function returns the previous
'converged' value.
2021-08-20 18:46:50 +02:00
Holger Vogt 034f8a4959 Don't do optran, if command optran is not given. 2021-08-20 17:09:20 +02:00
Holger Vogt e093844b18 Update comment: 0 is no initial iteration 2021-08-20 16:56:47 +02:00
Holger Vogt 3f68f91bf5 Add command 'write_ic'
Write out the right hand side status of the matrix in format
    .ic = V(node_xx)
    This may be possible at the end of a simulation or after a 'stop'
    of the simulation, which may be resumed again afterwars. This
    status may be used to start another simulation with these
    parameters by inluding into the netlist.
2021-08-20 15:30:02 +02:00
Holger Vogt 45dda4bbe2 Add command 'write_ic'
Write out the right hand side status of the matrix in format
.ic = V(node_xx)
This may be possible at the end of a simulation or after a 'stop'
of the simulation, which may be resumed again afterwars. This
status may be used to start another simulation with these
parameters by inluding into the netlist.
2021-08-20 15:29:47 +02:00
Holger Vogt f374e90ad4 if 'set ngdebug' print out transient initial conditions also with UIC set. 2021-08-20 15:29:15 +02:00
Holger Vogt a50f51760c make the error detection work properly 2021-08-20 15:28:58 +02:00
Holger Vogt edea5bf67b Use InpEvaluate() instead of strtod to enable ngspice numbers
with scale factors Meg k m u n p f etc.
2021-08-20 15:28:24 +02:00
Holger Vogt 15907a592c Reverse stepsize and finaltime in optran command,
stepsize first as in tran command.
2021-08-20 15:27:44 +02:00
Holger Vogt 9a42ff82a6 prevent crash if first breakpoint is beyond optran max time 2021-08-20 15:27:27 +02:00
Holger Vogt 86b1f6d6a6 test of supply ramping 2021-08-20 15:26:50 +02:00
Holger Vogt 3f27a560ee upon finishing 'optran', restore old CKTstep
remove unused
2021-08-20 15:25:59 +02:00
Holger Vogt c76ee6f275 safeguard command 'optran' against circuit no being loaded 2021-08-20 15:25:35 +02:00
Holger Vogt 5bbaa81c48 add missing header 2021-08-20 15:25:16 +02:00
Holger Vogt 0754a35296 header for optran 2021-08-20 15:25:03 +02:00