SpiceSharpBehavioral 3.2.0
dotnet add package SpiceSharpBehavioral --version 3.2.0
NuGet\Install-Package SpiceSharpBehavioral -Version 3.2.0
<PackageReference Include="SpiceSharpBehavioral" Version="3.2.0" />
paket add SpiceSharpBehavioral --version 3.2.0
#r "nuget: SpiceSharpBehavioral, 3.2.0"
// 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.
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 | |
Linux (Mono) | |
MacOS (Mono) |
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 | Versions 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. |
-
.NETStandard 2.0
- SpiceSharp (>= 3.2.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
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 | 225 | 9/1/2024 |
3.1.3 | 3,287 | 12/30/2021 |
3.1.2 | 1,234 | 8/24/2021 |
3.1.1 | 1,270 | 6/26/2021 |
3.1.0 | 4,448 | 4/24/2021 |
3.0.8 | 1,206 | 4/14/2021 |
3.0.7 | 2,605 | 4/10/2021 |
3.0.6 | 346 | 4/8/2021 |
3.0.5 | 409 | 3/21/2021 |
3.0.4 | 351 | 1/25/2021 |
3.0.3 | 379 | 12/14/2020 |
3.0.1 | 476 | 8/3/2020 |
3.0.0 | 423 | 8/3/2020 |
1.1.5 | 9,473 | 11/9/2019 |
1.1.4 | 485 | 11/8/2019 |
1.1.3 | 2,743 | 11/1/2019 |
1.1.2 | 504 | 10/30/2019 |
1.1.1 | 482 | 10/29/2019 |
1.1.0 | 1,477 | 8/24/2019 |
Refer to the GitHub release for release notes.