SpiceSharpBehavioral 3.2.0

This package has a SemVer 2.0.0 package version: 3.2.0+HEAD.37cefa9.
dotnet add package SpiceSharpBehavioral --version 3.2.0                
NuGet\Install-Package SpiceSharpBehavioral -Version 3.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpiceSharpBehavioral" Version="3.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SpiceSharpBehavioral --version 3.2.0                
#r "nuget: SpiceSharpBehavioral, 3.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SpiceSharpBehavioral as a Cake Addin
#addin nuget:?package=SpiceSharpBehavioral&version=3.2.0

// Install SpiceSharpBehavioral as a Cake Tool
#tool nuget:?package=SpiceSharpBehavioral&version=3.2.0                

SpiceSharpBehavioral

This library extends Spice# components with behavioral sources for modelling electronics circuits.

Documentation

The API can be found here

Quickstart

Including this library allows you to use two extra components:

  • BehavioralVoltageSource
  • BehavioralCurrentSource
using System;
using SpiceSharp;
using SpiceSharp.Components;
using SpiceSharp.Simulations;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            var ckt = new Circuit(
                new VoltageSource("V1", "in", "0", 0.0),
                new BehavioralVoltageSource("A1", "out", "0", "V(in)^2+2"));

            var dc = new DC("dc", "V1", -1, 1, 0.1);
            dc.ExportSimulationData += (sender, e) =>
            {
                Console.WriteLine(e.GetVoltage("out"));
            };
            dc.Run(ckt);
            Console.ReadKey();
        }
    }
}

Installation

Spice#.Behavioral is available as a NuGet package.

NuGet Badge Spice#.Behavioral

How does it work?

The parser parses expressions into functions. It automatically constructs derivatives to other unknown variables (eg. "V(in)"), to be able to correctly load the Y-matrix and Rhs-vector each iteration. Still, there are some things it cannot do:

  • Unsolvable circuits can occur. It becomes possible to bias circuits in impossible situations. For example, a component that does not dissipate power (but generates is), will cause the simulator to possibly throw cryptic exceptions as the circuit experiences a meltdown.
  • Unstable circuits. Nonlinear devices are notorious when it comes to convergence or numerical stability. For example, an exponential curve is known to converge very slowly for diodes, so Spice# implements a number of "tricks" to aid convergence. Using this library means that these "tricks" are now also to the user to implement.

Please use the library with care.

Current build status

Platform Status
Windows Windows Tests
Linux (Mono) Linux Tests
MacOS (Mono) MacOS Tests

Aim of Spice#.Behavioral?

The aim is to provide an easier way of prototyping models in the Spice# simulator. While it is technically possible for anyone to extend Spice# with custom models and components to have full control over its behaviors, Spice#.Behavioral takes away a lot of that work.

Advantages:

  • No prior knowledge needed about Newton-Raphson, Modified Nodal Analysis, etc.
  • No need for calculating derivatives by hand for models.
  • Changing models is likely easier and faster.

Disadvantages:

  • General performance can be sub-optimal.
  • It may be unclear for inexperienced users why a simulation became unstable or badly behaving.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SpiceSharpBehavioral:

Package Downloads
SpiceSharp-Parser

SPICE netlists parser for .NET

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.2.0 235 9/1/2024
3.1.3 3,289 12/30/2021
3.1.2 1,236 8/24/2021
3.1.1 1,272 6/26/2021
3.1.0 4,451 4/24/2021
3.0.8 1,208 4/14/2021
3.0.7 2,607 4/10/2021
3.0.6 348 4/8/2021
3.0.5 411 3/21/2021
3.0.4 353 1/25/2021
3.0.3 381 12/14/2020
3.0.1 478 8/3/2020
3.0.0 425 8/3/2020
1.1.5 9,475 11/9/2019
1.1.4 488 11/8/2019
1.1.3 2,747 11/1/2019
1.1.2 506 10/30/2019
1.1.1 484 10/29/2019
1.1.0 1,479 8/24/2019

Refer to the GitHub release for release notes.