Closed cyber-g closed 4 years ago
Dear Tom, Thanks for your reply ; your remark matches exactly the situation I have.
Looking again at the file example, the netlist has no title and begins directly with '.model ...'
I did not know the standard 1st line comment.
I will modify the netlist so that it is compliant.
It may be interesting to specify this element in the documentation.
How can I properly contribute ? In which file of the repository should I put this documentation element ?
(Sorry, I am beginning with this project and also beginner with python)
Best regards Germain
----- Mail original -----
De: "Tom Russo" notifications@github.com À: "FabriceSalvaire/PySpice" PySpice@noreply.github.com Cc: "cyber-g" cygerpham@free.fr, "Author" author@noreply.github.com Envoyé: Vendredi 20 Mars 2020 18:34:31 Objet: Re: [FabriceSalvaire/PySpice] "NameError: Netlist is empty" when using BSIM3 modelcards (and solution ?) (#189)
What I'm about to write may not be the problem you're describing, but it sounds like it might be. Standard SPICE netlist parsing considers the very first line of a netlist file as a comment (the title of the run). This has been true for as long as SPICE has existed. So if your top-level netlist file only has one line, the parser is correct to be ignoring that one line. If that's the issue, the correct solution is to add a title line to your netlist, not to modify the parser. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or unsubscribe .
Looking more closely to the PySpice library code (SpiceParser._parse()), I have seen that models files must have a comment at the first line Best regards
Environment (OS, Python version, PySpice version, simulator)
Debian GNU/Linux 10 (buster) Python 3.7.3 PySpice version : PySpice master on 20 March 2020 (version 1.3.2)
Problem statement and Actual Behaviour
I would like to use BSIM3 modelcards found in the archive : http://bsim.berkeley.edu/BSIM4/BSIM3/ftpv330.zip as "ftpv330/test/modelcard.nmos" and "ftpv330/test/modelcard.pmos"
When I put those files in the directory : PySpice/examples/libraries/transistor/ and rename as "*.mod" files, the example PySpice/examples/transistor/transistor.py fails to run :
Expected Behaviour
The example should execute properly ; I just added some files in the library directory.
Steps to reproduce the behaviour
I have prepared a Docker file to reproduce the behaviour. Dockerfile.txt
Solution
The solution to the problem is given as comments in the end of the dockerfile.
In the Parser class, there is a test on the length of the netlist after formatting '+'-lines and removing comments. In my case, the netlist was only one single line. And it triggers the error
NameError('Netlist is empty')
.That is why I propose to fix this issue by replacing the line
if len(lines) <= 1:
by :if len(lines) < 1:
Best regards