A comprehensive C# library for electrical engineering and electronics calculations. Compatible with .NET Framework 4.5+, .NET Core 3.1+, .NET 6.0+, .NET 8.0+, .NET 9.0+, and .NET Standard 2.0+.
$ dotnet add package CircuitToolA comprehensive C# library for electrical engineering and electronics calculations. CircuitTool simplifies circuit analysis, power calculations, and unit conversions for electrical engineers and electronics enthusiasts.
Clone the repository:
git clone https://github.com/jomardyan/CircuitTool.git
cd CircuitTool
Build the library:
dotnet build
Run the tests:
dotnet test
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
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Ω
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Ω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); // 1150Wusing 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 = 2300WhSee DOCUMENTATION.md for detailed API documentation.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT