SpiceSharp / SpiceSharpParser

SPICE netlists parser for .NET
MIT License
26 stars 6 forks source link

Add specific SPICE evaluators / decoders #12

Open ewiebe1 opened 6 years ago

ewiebe1 commented 6 years ago

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 commented 6 years ago

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

I need to add following features to make it work:

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 commented 6 years ago

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

marcin-golebiowski commented 6 years ago

@ewiebe1 Following features have been implemented:

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 commented 5 years ago

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

marcin-golebiowski commented 5 years ago

@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:

marcin-golebiowski commented 5 years ago

@ewiebe1 Do you have any other requests regarding SpiceSharpParser?

ewiebe1 commented 4 years ago

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 commented 4 years ago

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

svenboulanger commented 4 years ago

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.