Lenty / SLiCAP_python

Open-source version of SLiCAP, implemented in python
Other
33 stars 15 forks source link

Updating to latest version messed up the parsing #36

Closed structuredDesigner closed 2 years ago

structuredDesigner commented 2 years ago

Hi,

I was about to report the stuff below the "ORIGINAL BUG" section, but then I realized I didn't have the latest version. Not sure if the bug still stands in the new version.

After updating, I now got another bug:

Rell1 out 0 R 4 noisetemp=0 noiseflow=0 dcvar=0 ..............| Error: expected a parameter definition.

R1 N003 out R {Rf} noisetemp=0 noiseflow=0 dcvar=0 ..............| Error: expected a parameter definition.

R2 N003 0 R {Rg} noisetemp=0 noiseflow=0 dcvar=0

The previous version (I think 1.2.1) was handling these fine.

The relevant code I use is:

ac_design_filename = 'ac_design_origin_model'
 ac_design_filename_cir = ac_design_filename + '.cir'
 ac_design_filename_net = ac_design_filename + '.net'
 ac_design_filename_asc = ac_design_filename + '.asc'

 makeNetlist(ac_design_filename_asc ,"AC Design")

 i_ac_design = instruction()

 i_ac_design.setCircuit(ac_design_filename_cir)

 i_ac_design.defPar('Rf',19e3)
 i_ac_design.defPar('Rg',1e3)
 i_ac_design.defPar('Rs',600)

How can I solve this?

-------- ORIGINAL BUG ------------ Changing VJC=0.7 to 0.75 messes up the netlist2html or elementData2html function. To reproduce the problem, simply use the BJTD model but change the VJC from 0.7 to 0.75.

You'll get the following error message: /usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat Traceback (most recent call last): File "/usr/lib/python3/dist-packages/sympy/core/compatibility.py", line 419, in as_int raise TypeError TypeError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "AudioAmp_dynResp3_model.py", line 30, in elementData2html(i_acdesign.circuit) File "/home/ernesto/.local/lib/python3.8/site-packages/SLiCAP/SLiCAPhtml/SLiCAPhtml.py", line 369, in elementData2html numValue = '$' + sp.latex(roundN(fullSubs(elmt.params[param], circuitObject.parDefs), numeric=True)) + '$' File "/home/ernesto/.local/lib/python3.8/site-packages/SLiCAP/SLiCAPmath/SLiCAPmath.py", line 444, in fullSubs valExpr = newvalExpr.xreplace(substDict) File "/usr/lib/python3/dist-packages/sympy/core/basic.py", line 1192, in xreplace value, = self._xreplace(rule) File "/usr/lib/python3/dist-packages/sympy/core/basic.py", line 1207, in _xreplace a_xr = _xreplace(rule) File "/usr/lib/python3/dist-packages/sympy/core/basic.py", line 1207, in _xreplace a_xr = _xreplace(rule) File "/usr/lib/python3/dist-packages/sympy/core/basic.py", line 1214, in _xreplace return self.func(args), True File "/usr/lib/python3/dist-packages/sympy/core/cache.py", line 94, in wrapper retval = cfunc(args, **kwargs) File "/usr/lib/python3/dist-packages/sympy/core/power.py", line 301, in new obj = b._eval_power(e) File "/usr/lib/python3/dist-packages/sympy/core/add.py", line 395, in _eval_power if big > 0 and big != 1: File "/usr/lib/python3/dist-packages/sympy/core/numbers.py", line 1418, in ne return not self == other File "/usr/lib/python3/dist-packages/sympy/core/numbers.py", line 1406, in eq return other.eq(self) File "/usr/lib/python3/dist-packages/sympy/core/numbers.py", line 2248, in eq return Rational.eq(self, other) File "/usr/lib/python3/dist-packages/sympy/core/numbers.py", line 1906, in eq integer_log(self.p//m, 2) == (t, True) File "/usr/lib/python3/dist-packages/sympy/core/power.py", line 147, in integer_log y = as_int(y) File "/usr/lib/python3/dist-packages/sympy/core/compatibility.py", line 425, in as_int raise ValueError('%s is not an integer' % (n,)) ValueError: 1 is not an integer

antonmontagne commented 2 years ago

Before you use 'makeNetlist()' after updating SLiCAP to the latest version, you must first update your schematics, because new attributes have been added to symbols 'R', 'C' and 'L'. After doing this, the netlist entry for a resistor becomes: Rxx Node1 Node2 R value=< value > noisetemp=< noise temp., default={T} > noiseflow=< corner freq. 1/f noise > dcvar=< variance >