Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specific SPICE evaluators / decoders #12

Open
ewiebe1 opened this issue Sep 13, 2018 · 9 comments
Open

Add specific SPICE evaluators / decoders #12

ewiebe1 opened this issue Sep 13, 2018 · 9 comments
Labels
enhancement New feature or request

Comments

@ewiebe1
Copy link

ewiebe1 commented Sep 13, 2018

Please add PSpice specific evaluator / decoder

If you add PSpice specific code, it will result in an error, e.g.:

V_V1 N14847 0
+PULSE 0V 5V 3.67us 40ns 40ns 3.255us 6.51us
V_V2 N14651 0 5Vdc
R_R1 N18055 N14538 2.2k TC=0,0
R_R2 N17129 N14555 2.2k TC=0,0
C_C1 N14538 N14569 1n TC=0,0
C_C2 N14555 N14581 330p TC=0,0
R_R3 N14677 N14651 1k TC=0,0
R_R4 N14677 0 1k TC=0,0
R_R5 N14538 N14569 68k TC=0,0
R_R6 N14555 N14581 120k TC=0,0
C_C3 N14569 N17129 10n TC=0,0
X_U6 N14677 N14538 N14651 0 N14569 MCP651
X_U7 N14677 N14555 N14651 0 N14581 MCP651
C_C4 N14847 N18055 100n TC=0,0
V_V3 M_UN0001 0 AC 0
+SIN 2.5V 2.06V 153600 0 0 0
...

MCP651.txt

@marcin-golebiowski
Copy link
Member

marcin-golebiowski commented Sep 14, 2018

At the moment SpiceSharpParser is not able to parse PSpice specific netlist.

I need to add following features to make it work:

  • TABLE
  • POLY(1)/POLY(2)/POLY(3)
  • VALUE = {expression}
  • TC = TC1, TC2 for resistor

I will work on that but I estimate that I can take at least 2 months of work.
Do you have any questions?

Kind regards
Marcin

@marcin-golebiowski marcin-golebiowski added the enhancement New feature or request label Sep 14, 2018
@marcin-golebiowski
Copy link
Member

@ewiebe1 I've started to work on that features.

@marcin-golebiowski
Copy link
Member

marcin-golebiowski commented Oct 25, 2018

@ewiebe1 Following features have been implemented:

  • TABLE syntax (ABM)
  • POLY(n) syntax (ABM)
  • VALUE = {expression} (ABM)
  • TC = TC1, TC2 for resistor

I will continue to work on ability to parse and run PSpice netlists.
I think in one month you will be able to parse the netlist you posted using SpiceSharpParser.
Is there any special netlist that you would like to parse? Anything I could help?

Marcin

@ewiebe1
Copy link
Author

ewiebe1 commented Nov 14, 2018

Hello Marcin, many thanks for your work!

Today, I have made an other test:
I have downloaded the current version of SpiceSharpParser and created a small Test Application. In this test application I go through all *.cir files from the examples folder of ngspice28.
There were many Exceptions while parsing these files.

My code snippet:
private void TestNetlist(string path_netlist)
{
try
{
SpiceParserSettings sps = new SpiceParserSettings();
sps.WorkingDirectory = path_netlist.Substring(0, path_netlist.LastIndexOf("\"));
SpiceParser sp = new SpiceParser(sps);
string netlist = File.ReadAllText(path_netlist);
sp.ParseNetlist(netlist);
}
catch (Exception Ex)
{
AddLog("Error with " + path_netlist + " : " + Ex.Message);
}
}

See attached files.
Thank you for your work again!

parsing log of ngspice 28.txt

ngspice examples.zip

@ewiebe1 ewiebe1 changed the title Add PSpice specific evaluator / decoder Add specific SPICE evaluators / decoders Nov 14, 2018
@marcin-golebiowski
Copy link
Member

marcin-golebiowski commented Nov 14, 2018

@ewiebe1 I will work also on ability to parse ngspice28 netlists. Thank you for examples.
I will try my best, but It will take time to write all necessary features to SpiceSharpParser.

Regarding the netlist you posted (MCP651.txt) it's quite close to successful parsing.
In the next release of SpiceSharp/SpiceSharpParser we are adding in particular:

  • TC1, TC2 for capacitor.
  • PWL waveform
    We also need to extend mosfet model to allow w and l parameters.
    However I think there is an error in MCP651.txt regarding brackets for TABLE (line 138).

@marcin-golebiowski
Copy link
Member

@ewiebe1 Do you have any other requests regarding SpiceSharpParser?

@ewiebe1
Copy link
Author

ewiebe1 commented Apr 8, 2020

I found out today that LTSpice uses also some special features in its SPICE netlists, like "A-Devices".
See here: Undocumented LTSpice parser features

Perhaps the SpiceSharpParser should also be able to parse such special LTSpice netlists ?

@marcin-golebiowski
Copy link
Member

@ewiebe1
I think it would be not difficult to parse that. However much harder is to simulate that components.

@svenboulanger
Copy link
Member

I agree with @marcin-golebiowski . Supporting these custom models is difficult because they'd have to be reverse-engineered. Instead, it may be better to just roll out custom models.

I currently have my hands full with Spice# and Spice#.Behavioral v3, so I don't see this implemented in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants