Giter VIP home page Giter VIP logo

spicesharpparser's Introduction

Spice#/SpiceSharpParser

Windows Linux codecov CodeFactor Sonarcloud Status Sonarcloud Status Sonarcloud Status Lines of Code Duplicated Lines (%) FOSSA Status

SpiceSharpParser is a .NET library that allows to parse SPICE netlists and to simulate them using SpiceSharp.

Installation

SpiceSharpParser is available as NuGet Package.

Quickstart

Parsing a netlist and executing a simulation is relatively straightforward. For example:

using System;
using System.Linq;
using SpiceSharpParser;

namespace SpiceSharpParserExample
{
    class Program
    {
        static void Main(string[] programArgs)
        {
            var netlist = string.Join(Environment.NewLine,
                "Diode circuit",
                "D1 OUT 0 1N914",
                "V1 OUT 0 0",
                ".model 1N914 D(Is=2.52e-9 Rs=0.568 N=1.752 Cjo=4e-12 M=0.4 tt=20e-9)",
                ".DC V1 -1 1 10e-3",
                ".SAVE i(V1)",
                ".END");

            // Parsing part - SpiceSharpParser
            var parser = new SpiceParser();
            var parseResult = parser.ParseNetlist(netlist);
            var spiceModel = parseResult.SpiceModel;

            // Simulation part - SpiceSharp
            var simulation = spiceModel.Simulations.Single();
            var export = spiceModel.Exports.Find(e => e.Name == "i(V1)");
            simulation.ExportSimulationData += (sender, args) => Console.WriteLine(export.Extract());
            simulation.Run(spiceModel.Circuit);
        }
    }
}    

Compatibility

PSpice

SpiceSharpParser is able to parse some of PSpice netlists. At the moment due to lack of implementation of LAPLACE and FREQ (part of analog behavioral modeling) and other features parsing or simulation can fail.

Capabilities

Analog Behavioral Modeling supported:

  • POLY(n)
  • TABLE
  • VALUE

Note: Only voltage and current expressions are supported in TABLE, VALUE

Dot statements supported:

Statement Documentation
.AC Wiki
.APPENDMODEL Wiki
.DC Wiki
.DISTRIBUTION Wiki
.ELSE Wiki
.ENDIF Wiki
.FUNC Wiki
.GLOBAL Wiki
.IC Wiki
.IF Wiki
.INCLUDE Wiki
.LET Wiki
.LIB Wiki
.MC Wiki
.NODESET Wiki
.NOISE Wiki
.OP Wiki
.OPTIONS Wiki
.PARAM Wiki
.PLOT Wiki
.PRINT Wiki
.TRAN Wiki
.SAVE Wiki
.SPARAM Wiki
.ST Wiki
.STEP Wiki
.SUBCKT Wiki
.TEMP Wiki

Device statements supported:

Device Statement Documentation
B (Arbitrary Behavioral Voltage or Current Source) Wiki
C (Capacitor) Wiki
D (Diode) Wiki
E (Voltage-Controlled Voltage Source) Wiki
F (Current-Controlled Current Source) Wiki
G (Voltage-Controlled Current Source) Wiki
H (Current-Controlled Voltage Source) Wiki
I (Independent Current Source) Wiki
J (JFET) Wiki
K (Mutual Inductance) Wiki
L (Inductor) Wiki
M (Mosfet) Wiki
Q (Bipolar Junction Transistor) Wiki
R (Resistor) Wiki
S (Voltage Switch) Wiki
T (Lossless Transmission Line) Wiki
V (Independent Voltage Source) Wiki
W (Current Switch) Wiki
X (Subcircuit) Wiki

Documentation

License

SpiceSharpParser is under MIT License

FOSSA Status

spicesharpparser's People

Contributors

marcin-golebiowski avatar svenboulanger avatar fossabot avatar

Watchers

 avatar James Cloos avatar

Forkers

fossabot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.