Commit Graph

503 Commits

Author SHA1 Message Date
Giles Atkinson 31fcd7d561 Correct the digital state resolution table, that was previously asymmetric.
An equivalent change is mentioned in the SPICE OPUS change history.
2022-09-23 13:15:07 +02:00
Giles Atkinson af09a06cdb Add bidirectional digital/analog bridge. 2022-09-23 13:15:07 +02:00
Giles Atkinson 118b997642 Add two functions to the Code Model Library: cm_get_node_name()
makes circuit node names available to diagnostics, while
cm_probe_node() is needed for a bidirectional A/D bridge.
2022-09-23 13:15:07 +02:00
Giles Atkinson 2f9403d143 Prevent overwriting of previous debug output when expanding auto-bridge deck. 2022-09-23 13:15:07 +02:00
Giles Atkinson 8156745c97 Rewrite code with Visual Studio complaints. 2022-09-23 13:15:06 +02:00
Holger Vogt 453350bf2f safeguard against circuit not being abvailable,
avoid crash
2022-09-18 11:11:56 +02:00
Holger Vogt 3d625bc1ef pwlts: a pwl v/i source with time input, smoothing and limiting functions 2022-09-09 15:24:37 +02:00
Holger Vogt 8ef0c03fa6 Prevent a crash if (due to input error) the node_table is not available. 2022-09-04 17:35:47 +02:00
Holger Vogt 04ded78ef6 Prevent crashes when nodes or tables are not available,
e.g. due to missing input file.
2022-08-31 15:43:20 +02:00
Giles Atkinson 3901c0a865 Remove search for "family" parameters on subcircuits in XSPICE
automatic bridging support as string-valued parameter support is
not yet intgrated.
2022-08-31 15:34:09 +02:00
Giles Atkinson 495172f532 Latest auto-bridge code from development branch. 2022-08-31 15:34:04 +02:00
Giles Atkinson 148cecf919 Insert XSPICE bridging devices automatically when an analogue node
has the same name as an XSPICE event node (including digital nodes).
The function Evtcheck_nodes() is replaced by a new version in its
own file.
2022-08-31 15:33:59 +02:00
Holger Vogt 3fc3997cef Handle the case when control voltages on and off are equal.
Update the linear switch: add the limits to resistance ron, roff
Update the log switch: correct the resistance calculation for
von < voff
Add some examples for the pswitch.
2022-08-05 17:30:08 +02:00
Giles Atkinson f878878bd8 Remove some dead code in the dec_bridge code model. 2022-07-24 12:23:24 +02:00
Giles Atkinson 659b426cf8 Fix double free in XSPICE CALLBACK functions as desribed here:
https://sourceforge.net/p/ngspice/mailman/message/37677362/
and add missing CALLBACKs in models that use STATIC_VARs with
pointer values.
2022-07-24 12:23:19 +02:00
Giles Atkinson 2406846a21 Extend the output and partial derivatives of the output from the 2/3-D
table lookup models (XSPICE) continuously outside the defined
rectangle or cube, as it may help convergence and avoid ambiguity caused
by rounding at the boundaries.  See bug #591 "Wrong 2D table model output".
The value is that of the nearest point in the region while the reported
derivative is ramped to zero outside the boundaries.
Also fixes incorrect output at the upper limit in each dimension.
2022-07-24 12:23:15 +02:00
Giles Atkinson ec725c3814 Fix memory leak by moving the state transition table to a STATIC_VAR
whose memory can be recovered by a call back.  Also make cfunc.mod
less ugly.
2022-07-24 12:23:05 +02:00
Holger Vogt 8f4e712a11 Preliminary fix to enable the core model with hysteresis.
Make error message more verbose.
2022-05-16 16:29:08 +02:00
Giles Atkinson b26be81444 Fix XSPICE memory leaks found by valgrind. 2022-05-08 17:59:11 +02:00
Holger Vogt 31a0f3eaf6 d_pwm: Add a hybrid oscillator (analg control in, digital out) with PWM
(pulse width modulation) capability, oscillation frequency is a parameter.

The model has been derived from the d_osc example.
2022-03-04 11:43:18 +01:00
Holger Vogt 7130097710 Prevent crash when no simulation has been run and
asking for plotting an event node
2022-02-19 17:23:36 +01:00
Giles Atkinson 16f586b65e Respect the "tstart" parameter when saving event node data (XSPICE).
Fixes Support Request #47: "XSpice memory usage (TRAN TSTART effect)".
2022-01-28 12:25:36 +01:00
Brian Taylor 08bc3ccdd6 Remove compiler warnings (writ_ifs.c ipcsockets.c). 2022-01-13 14:54:16 +01:00
Holger Vogt f0e9a35eb6 Add 'esave' command to save only specific event nodes.
Add a prompt for esave/eprint/eprvcd.
2022-01-09 10:58:38 +01:00
Holger Vogt 9308c6b077 Reuse memory for queued events.
Patch #109 - 2 provided by Giles Atkinson
2022-01-03 22:11:03 +01:00
Holger Vogt 8263e2a4da The AD and DA hybrid XSPICE bridges consume a lot of
memory (one state per time step added). Memory of
previous time steps is not recovered.

Patch #109 by Giles Atkinson reduces memory consumption
dramatically (> factor of 10).
2022-01-01 16:14:48 +01:00
Holger Vogt 9be9f46f96 Remove unused function Evt_Data_destroy() 2021-12-16 08:04:44 +01:00
Holger Vogt 2f98a5b305 evtprint: prevent a crash when eprint has been called
but there is no simulation run.
2021-12-13 21:44:02 +01:00
Holger Vogt 6b41ad433a Remove memory leak
Free some tokens generated by CNVget_token
Initialize reset and clk

Still missing: free 'states'
2021-12-13 21:32:15 +01:00
Holger Vogt 36fa47a8a0 Remove memory leak
Add callback function free_local_data
Free some tokens generated by CNVget_token
2021-12-13 21:31:49 +01:00
Holger Vogt c895ca33f7 Pswitch: Fix a bug in resistance calculation when cntl_on < cntl_off
Correct setting of parens
2021-10-29 16:35:47 +02:00
Holger Vogt eee639d98d 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-10-29 16:28:25 +02:00
Holger Vogt 4ce4f52938 XSPICE d_source: prevent a crash when the input file is not found 2021-09-29 20:30:10 +02:00
Holger Vogt d4c559421e prevent crash if info.node_table has not been defined,
caused by some preceding error.
2021-09-29 20:29:54 +02:00
Holger Vogt 6aac403ab0 XSPICE delay: add some more safeguards 2021-08-03 15:53:42 +02:00
Holger Vogt 028dd0ab88 Remove unused
Add a delay of half a time step to reduce error
2021-07-05 14:24:46 +02:00
Holger Vogt abc6eb56f3 Plausibility checking
Enforce out=in when delay == 0
2021-07-05 14:24:29 +02:00
Holger Vogt fbab9a0fe2 Add an analog delay source for transient simulation
Internal circular memory of size tstop/tstep or user defined.
(aprox.) every tstep a value is stored.
Delay time in multiples of tstep, by control voltage or user defined.
Dc or ac sim will simply connect input to output.
2021-07-05 14:24:06 +02:00
Holger Vogt 93f6a50553 New author 2021-07-05 14:20:14 +02:00
Holger Vogt 22a516bc4d New author 2021-07-05 14:19:56 +02:00
Holger Vogt d36fcaf34c Neew pswitch with patch 0001-pswitch-fix.patch from Jube 3rd, 21 at
https://sourceforge.net/p/ngspice/discussion/127605/thread/d55d2322f2/#c966/b802/4764/2540/3b3f/04a4/bc51/3a68

Input resistance, numerically computed derivatives with auto-partial, reasonable limits.
2021-07-05 14:19:43 +02:00
Holger Vogt f12592871a Set derivative d out/d contrl to 0 if outside of switching range.
Disable auto derivatives.
Enable algorithmic derivatives.
2021-07-05 14:18:08 +02:00
Holger Vogt 6d9876229c Fixes bug #331
Bug detected and analysed by Arsen Liash
Patch provided by Yurii Demchyna
2021-07-05 14:16:35 +02:00
Holger Vogt 19ddeb8fe6 formatting (not complete) 2021-07-02 11:54:59 +02:00
Holger Vogt 545d2f9177 Report an error when trying to define ports
'v', 'vd', 'i', and 'id' as 'inout'
Parch 105 provided by  Giles Atkinson
2021-07-02 11:54:34 +02:00
Holger Vogt d7feec20fe enable parameter 'gain'
patch provided by  Bohdan Tkhir
2021-02-21 16:48:28 +01:00
Holger Vogt d45e95aa4c We no longer want to install cmpp or other XSPICE files.
The manual describes making code models from inside
the ngspice build process, and that's what we support
right now.
2021-01-23 12:43:51 +01:00
Holger Vogt a5eac333bb Revert "When installing ngspice, do not install the headers"
This reverts commit 5a0d213fec.
2021-01-22 16:05:14 +01:00
Holger Vogt 176023f470 Remove compiler warnings 2021-01-03 14:28:22 +01:00
Holger Vogt 3c354092ff Line endings from \r\n to \n 2021-01-02 19:06:58 +01:00