Commit Graph

3432 Commits

Author SHA1 Message Date
Giles Atkinson fbebfb708c Two memory leaks found interactively with valgrind with safe fixes. 2022-05-10 08:29:54 +01:00
Giles Atkinson 4fd0a68fb2 Fix memory leak found by valgrind/paranoia. 2022-05-10 08:25:28 +01:00
Giles Atkinson 55e8975124 Suppress warning from gcc 10.2.1. 2022-05-09 10:51:18 +02:00
Giles Atkinson 44c68183e8 Further change for #578 "Crash while plotting single complex vector".
Move the check on vector lengths to ensure all cases are covered.
2022-05-03 17:00:11 +02:00
Giles Atkinson e6bbbefa10 Suppress warnings from function pointer casts seen with gcc 10.2.1. 2022-04-30 15:26:57 +02:00
Holger Vogt ea0cdbd6d7 Set {} to remove compiler warning (VS) 2022-04-29 14:32:11 +02:00
Holger Vogt 52d0e69710 Add a note that wrs2p currently is limited to two ports only. 2022-04-28 14:14:13 +02:00
Holger Vogt 1d8dacedaa S-parameters: Replace S11 by S_1_1 etc. to avoid ambiguity
when more than 10 ports are measured.
Update to S-parameter script and command wr2sp
2022-04-28 11:58:21 +02:00
Holger Vogt dcf9c1027a Add new flags to command devhelp:
-type (show parameter types)
-flags (show parameter flags)
Patches provided by Mikolaj Wielgus
2022-04-27 08:46:26 +02:00
Giles Atkinson ce81dd7fd9 Rename a variable so that it does not clash with one in outer scope. 2022-04-25 21:12:57 +02:00
Holger Vogt f12f31bed6 Searching for params: as plain identifier 2022-04-25 16:26:30 +02:00
Holger Vogt 7924af7f22 Remove the special handling of X... device names.
Subcircuit devices are saved with leading X in their names.
2022-04-25 15:18:25 +02:00
Giles Atkinson dd7ec4470d Fix Bug #577 "Zooming iplot drops vectors" and three crashes when
the iplot window is closed during simulation.
2022-04-25 13:53:41 +02:00
Holger Vogt 28a39a51d6 Search for "off" token in device instance lines not with
C standard fcn strstr, but with search_plain_identifier().
Thus allow model names that contain "off" (like offset)
2022-04-25 13:38:37 +02:00
Holger Vogt 7703c2d370 Add a function itoa10 and use it
instead of non-standard itoa.
2022-04-25 13:35:23 +02:00
Holger Vogt 4aa5d784ec When calculating power, we need to exclude thermal nodes
of devices like diodes (d) and MOS (m)
2022-04-25 11:35:29 +02:00
Holger Vogt 458b6cf776 Add flag 'power' to fcn setallvsources()
Add code to calculate the power dissipation in a device
(top level instances, including X (subcircuit) invocations).
2022-04-23 20:07:52 +02:00
Holger Vogt 761da8ad0e revert polarity of current mesurements:
current positive when flowing into device, e.g.
Ic, Ib of a positively biased npn.

Add current measurement for all nodes of a device,
e.g. .probe i(Q1) will measure Ic, Ib, Ie (and Is)
2022-04-22 17:46:55 +02:00
Giles Atkinson 724cf4e638 Fix Bug #402 "Crash related to aliases". Do not return freed pointer. 2022-04-21 15:48:50 +02:00
Holger Vogt 2aa950fe9c Remove a conflict between the text variable substitution like
set text = "mytext"
set newtext = new.{$text}
echo $newtext
and the command circbyline, which may have to process strings
containing braces {...} without any change to the string.

Do not call cp_doglob() when command circbyline is executed.
2022-04-19 23:26:26 +02:00
Holger Vogt 7985b05aec make comment more verbose 2022-04-19 23:22:17 +02:00
Holger Vogt ae221a70c2 Remove a typo: runable --> runnable 2022-04-15 10:52:56 +02:00
Holger Vogt cd01f4949e Make error message more verbose 2022-04-11 12:05:54 +02:00
Giles Atkinson e16564edf7 Make "nogrid" plotting option work. The deleted code was in the original
commit, so the reason for it can not be traced.
2022-04-06 10:24:16 +02:00
Alessio Cacciatori abd5b5ea04 S-parameters in ngspice
With this commit the patch provided by Alessio Cacchiatori the S-parameter is completed:
Noise simulation added with C matrix output
Y and Z matrix output enabled

To allow compiling with gcc, the dense.h inline functions have been put into denseinlines.h
2022-03-29 09:06:10 +02:00
Holger Vogt 86132f445d We start not at 0, but use the mean value (given in PARAM2) as
start value
2022-03-28 18:00:14 +02:00
Vadim Kuznetsov e52ea6109a Patch allowing call to S parameter simulation also from .control section by using command 'sp' 2022-03-27 10:40:12 +02:00
Holger Vogt ae3d171d91 Prevent a segfault when the parameter to command 'repeat' is given,
but cannot be evaluetd to a number.
2022-03-21 16:53:37 +01:00
Holger Vogt 714aae3d2f .probe: replace (all) by alli (we only measure all currents) 2022-03-14 10:56:16 +01:00
Holger Vogt dd2eb6c652 Make function search_plain_identifier non-static
Declare info on the compatibility mode as a 'Note'.
2022-03-14 10:54:47 +01:00
Holger Vogt dec3fd0fd9 adding expressions in {} as pwl parameters
not complete, still requires caring about the FIXME above.
2022-03-13 11:39:06 +01:00
Holger Vogt 509c2347cc Remove the "type" declaration from a .model line 2022-03-13 11:24:33 +01:00
Holger Vogt d14ea924b3 Use #ifdef XSPICE to exclude findvec_alle() if
XSPICE is not selected.
2022-03-11 23:32:25 +01:00
Holger Vogt b0a54137a9 exclude 'type=xxx' from model declaration 2022-03-11 23:31:26 +01:00
Holger Vogt f21255ef1b Fix regression bug #579
Accept numbers to ac statement in voltage (current) sources
also given as parameters.
2022-02-22 20:39:20 +01:00
Holger Vogt 20d5919e59 Terminal setting to X11 fails in macOS, and is not required
on Linux.
Setting terminal here is redundant, so remove this setting.
2022-02-22 15:22:21 +01:00
Holger Vogt 12a93c9fe6 Update to plotting of event nodes:
Distance is now 1.5, scaling and cutouts are possible
(with some lack of precision).

Still missing: y axis labeling (no numbers, but node names).
2022-02-21 20:19:56 +01:00
Holger Vogt 342a16d6e1 Add a flag 'alle' (all event nodes) to the plot command (and maybe others).
All event nodes with length greater than 1 are translated to vectors
with a common scale (named step) and are assembled in a new plot
named 'digital'. They may be plotted or otherwise used in a
.control section.
2022-02-21 20:16:20 +01:00
Holger Vogt 0557bc60bf Prevent crash if nsp is evaluated to 0 2022-02-21 16:56:16 +01:00
Holger Vogt 917dab9da7 new flag 'digitop' for the 'plot' command:
Plot digital (event nodes) vertically, separated by 0.1
The grid is adapted acordingly.
set xbrushwidth=3 will yield good results.
2022-02-19 17:25:57 +01:00
Alessio Cacciatori 2c10c4aebd S parameter simulation
Command '.sp'
arbitrary number of ports
ports made with modified VSRC

Patch provided by Alessio Cacciatori
https://sourceforge.net/p/ngspice/discussion/127605/thread/7a2655c86f/
2022-02-17 15:48:00 +01:00
Brian Taylor b774d03162 Change the y-axis direction for a 2d Cider gnuplot. The device surface is at the top and downwards is into the material, which is the normal presentation. Note that the x/y mesh commands in a Cider model also affect the orientation. 2022-02-17 15:45:28 +01:00
Holger Vogt 62f326b9d0 Fix a bug from previous commit: min -> MIN 2022-02-07 22:39:27 +01:00
Holger Vogt 0eb272243f Enable RKM notation also for inductors (e.g. 1u2 for 1.2u) 2022-02-07 16:00:29 +01:00
Holger Vogt 640fa7e17b bug 578 crash when scale is too short
Warning message if scale and vector length do not match.
Restrict number of points plotted to the smaller of both.
2022-02-07 15:59:43 +01:00
Holger Vogt 4f82a24df2 Add parameter 'isgrid' to plotting of arcs.
Smithgrid and polar plots could not discern between xgridwidth and
xbrushwidth. This is now available, similar to straight line plotting.
Tested also for PS and SVG.
2022-02-01 12:23:29 +01:00
Giles Atkinson 6494befb2f Request backing store for X11 plot windows. When supported by the X server
windows are redrawn vey quickly without replotting.
2022-01-28 12:24:58 +01:00
Giles Atkinson f4285384e7 Add code in graf.c to merge connected lines with the same slope before
plotting.  This speeds output and reduces file size when the vector
length is much larger than the number of pixels.  It should help with
Feature Request #58:
  "Graph plotting under windows redraw very slow and hard to work with",
but is not a full fix.
2022-01-28 12:24:51 +01:00
Holger Vogt ce9bc9fc64 The re-painting due to mouse-click under MS Windows is caused by line 561
of windisp.c. Upon left mouse button up the plot recangle is invalidated,
and a WM_PAINT message is generated (same on line 614 for right mouse
button up). If not re-pained, artifacts may be left on the canvas after
collecting coordinate data.

Shifting the command InvalidateRect to a place where it becomes active
only after the mouse has been moved, does the trick. Simple clicking
(right or left) will not cause a re-paint any more.
2022-01-28 12:11:39 +01:00
Kevin Zheng 857fbec985 Improve iteration limit options display 2022-01-17 12:06:35 +01:00