docs
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title> Spice# (SpiceSharp) </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content=" Spice# (SpiceSharp) ">
<meta name="generator" content="docfx ">
<link rel="shortcut icon" href="api/images/favicon.ico">
<link rel="stylesheet" href="styles/docfx.vendor.css">
<link rel="stylesheet" href="styles/docfx.css">
<link rel="stylesheet" href="styles/main.css">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="toc.html">
<script type="text/javascript" async="" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>
</head> <body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
<img id="logo" class="svg" src="api/images/favicon.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">
<div class="article row grid">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="">
<h1 id="-spice-spicesharp"><img src="https://spicesharp.github.io/SpiceSharp/api/images/logo_full.svg" width="45px"> Spice# (SpiceSharp)</h1>
<p>Spice# is a Spice circuit simulator written in C#. The framework is made to be compatible with the original Berkeley Spice simulator, but bugs have been squashed and features can and will probably will be added.</p>
<h2 id="documentation">Documentation</h2>
<p>You can find documentation at <a href="https://spicesharp.github.io/SpiceSharp/">https://spicesharp.github.io/SpiceSharp/</a>. There you can find a guide for <strong>getting started</strong>, as well as more information about:</p>
<ul>
<li>Supported types of analysis.</li>
<li>The general structure of Spice#.</li>
<li>A tutorial on how to implement your own <em>custom</em> model equations (prerequisite knowledge needed).</li>
<li>An example of changing parameters during simulation.</li>
<li>etc.</li>
</ul>
<h2 id="quickstart">Quickstart</h2>
<p>Simulating a circuit is relatively straightforward. For example:</p>
<pre><code class="lang-csharp">using System;
using SpiceSharp;
using SpiceSharp.Components;
using SpiceSharp.Simulations;
namespace SpiceSimulation
{
class Program
{
static void Main(string[] args)
{
// Build the circuit
var ckt = new Circuit(
new VoltageSource("V1", "in", "0", 0.0),
new Resistor("R1", "in", "out", 1.0e3),
new Resistor("R2", "out", "0", 2.0e3)
);
// Create a DC sweep and register to the event for exporting simulation data
var dc = new DC("dc", "V1", 0.0, 5.0, 0.001);
// Run the simulation
foreach (int exportType in dc.Run(ckt))
{
Console.WriteLine(dc.GetVoltage("out"))
}
}
}
}
</code></pre>
<p>Most standard Spice-components are available, and building your own custom components is also possible!</p>
<h2 id="installation">Installation</h2>
<p>Spice# is available as a <strong>NuGet Package</strong>.</p>
<p><a href="https://www.nuget.org/packages/SpiceSharp/"><img src="https://buildstats.info/nuget/spicesharp" alt="NuGet Badge"></a> SpiceSharp</p>
<h2 id="current-build-status">Current build status</h2>
<table>
<thead>
<tr>
<th style="text-align: left;"></th>
<th style="text-align: right;">Status</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Windows</td>
<td style="text-align: right;"><img src="https://github.com/SpiceSharp/SpiceSharp/workflows/Windows%20Tests/badge.svg" alt="Windows Tests"></td>
</tr>
<tr>
<td style="text-align: left;">MacOS</td>
<td style="text-align: right;"><img src="https://github.com/SpiceSharp/SpiceSharp/workflows/MacOS%20Tests/badge.svg" alt="MacOS Tests"></td>
</tr>
<tr>
<td style="text-align: left;">Linux/Ubuntu</td>
<td style="text-align: right;"><img src="https://github.com/SpiceSharp/SpiceSharp/workflows/Linux%20Tests/badge.svg" alt="Linux Tests"></td>
</tr>
</tbody>
</table>
<h2 id="aim-of-spice">Aim of Spice#?</h2>
<p>Spice# aims to be:</p>
<ul>
<li>A <strong>Library</strong> rather than a standalone piece of software like most simulators currently are.</li>
<li><strong>Accessible</strong> for both the amateur and advanced electronics enthusiast (and perhaps professional designer). In order to decrease the hurdle, a <a href="https://github.com/SpiceSharp/SpiceSharpParser">Spice# parser</a> is also being developed. This also includes it being cross-platform (.NET and Mono).</li>
<li><strong>Compatible</strong> with the <em>original Spice 3f5</em> software (without the bugs). There's a reason why this has become the industry standard.</li>
<li><strong>Customizable</strong> with custom simulations, custom models, integration methods, solver, etc.</li>
<li><strong>Performance</strong>, but still completely managed code. Nobody wants a slow simulator.</li>
</ul>
<h2 id="what-spice-is-not">What Spice# is not</h2>
<p>Having been implemented in the .NET framework does have some limitations:</p>
<ul>
<li>Unmanaged C/C++ code can often be optimized more than managed code.</li>
<li>Spice# uses <em>Reflection</em> to give you a better experience. However if you decide to use reflection, you may feel some performance hit.</li>
</ul>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<h5>In this article</h5>
<div></div>
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="styles/docfx.vendor.min.js"></script>
<script type="text/javascript" src="styles/docfx.js"></script>
<script type="text/javascript" src="styles/main.js"></script>
</body>
</html>