CircuitTool 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package CircuitTool --version 1.0.2
                    
NuGet\Install-Package CircuitTool -Version 1.0.2
                    
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="CircuitTool" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CircuitTool" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="CircuitTool" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CircuitTool --version 1.0.2
                    
#r "nuget: CircuitTool, 1.0.2"
                    
#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.
#:package CircuitTool@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CircuitTool&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=CircuitTool&version=1.0.2
                    
Install as a Cake Tool

CircuitTool

A comprehensive C# library for electrical engineering and electronics calculations. CircuitTool simplifies circuit analysis, power calculations, and unit conversions for electrical engineers and electronics enthusiasts.

Features

  • Ohm's Law Calculations: Calculate voltage, current, and resistance
  • Resistor Network Analysis: Series and parallel resistor calculations
  • Voltage Analysis: Voltage drop and voltage divider calculations
  • Power Calculations: Various methods to calculate electrical power
  • Energy Calcululations: Convert between energy units, calculate energy costs
  • Unit Conversions: Comprehensive electrical unit conversion utilities
  • Specialized Calculators: Power factor, electricity bill, and energy consumption calculators
  • Advanced Circuit Analysis: Total resistance, power, and energy calculations for complex circuits

Getting Started

Prerequisites

  • .NET 8.0 SDK or later

Installation

Clone the repository:

git clone https://github.com/jomardyan/CircuitTool.git
cd CircuitTool

Build the library:

dotnet build

Run the tests:

dotnet test

Installation via NuGet

To install CircuitTool via NuGet, use the following command:

nuget install CircuitTool

Or add it to your project using the .NET CLI:

dotnet add package CircuitTool

Usage Examples

Ohm's Law Calculations

using CircuitTool;

// Calculate voltage using Ohm's Law (V = I × R)
double voltage = OhmsLawCalculator.Voltage(2.0, 5.0);  // 2A through 5Ω = 10V

// Calculate current using Ohm's Law (I = V / R)
double current = OhmsLawCalculator.Current(10.0, 5.0);  // 10V across 5Ω = 2A

// Calculate resistance using Ohm's Law (R = V / I)
double resistance = OhmsLawCalculator.Resistance(10.0, 2.0);  // 10V with 2A = 5Ω

Resistor Network Analysis

using CircuitTool;

// Calculate total resistance of resistors in series
double seriesResistance = ResistorCalculator.Series(10.0, 20.0, 30.0);  // = 60Ω

// Calculate total resistance of resistors in parallel
double parallelResistance = ResistorCalculator.Parallel(10.0, 10.0);  // = 5Ω

Voltage and Power Calculations

using CircuitTool;

// Calculate voltage drop across a resistor
double voltageDrop = VoltageCalculator.VoltageDrop(10, 2); // 20V

// Use a voltage divider
double outputVoltage = VoltageCalculator.VoltageDivider(9, 2, 1); // 3V

// Calculate power from voltage and current
double power = PowerCalculator.Power(230, 5); // 1150W

Advanced Circuit Analysis

using CircuitTool;

// Calculate total resistance in series
var seriesResistance = CircuitCalculations.CalculateTotalResistance(new double[] { 10, 20, 30 }, true);

// Calculate total resistance in parallel
var parallelResistance = CircuitCalculations.CalculateTotalResistance(new double[] { 10, 20, 30 }, false);

// Calculate power
var power = CircuitCalculations.CalculatePower(230, 5); // 230V × 5A = 1150W

// Calculate energy
var energy = CircuitCalculations.CalculateEnergy(1150, 2); // 1150W × 2h = 2300Wh

Documentation

See DOCUMENTATION.md for detailed API documentation.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.1 97 6/27/2025
2.2.0 86 6/27/2025
2.1.0 122 6/27/2025
2.0.0 131 6/26/2025
1.0.13 131 6/26/2025
1.0.11 134 6/26/2025
1.0.7 132 6/26/2025
1.0.5 130 6/26/2025
1.0.4 130 6/26/2025
1.0.3 130 6/26/2025
1.0.2 130 6/26/2025
1.0.1 137 6/26/2025
1.0.0 136 6/26/2025