diff --git a/UnitsNet.Tests/CustomCode/ElectricCurrentTests.cs b/UnitsNet.Tests/CustomCode/ElectricCurrentTests.cs
index 339b51ef65..bcbd6b209e 100644
--- a/UnitsNet.Tests/CustomCode/ElectricCurrentTests.cs
+++ b/UnitsNet.Tests/CustomCode/ElectricCurrentTests.cs
@@ -34,5 +34,12 @@ public void ElectricCurrentTimesElectricResistanceEqualsElectricPotential(float
ElectricPotential potential = ElectricCurrent.FromAmperes(current) * ElectricResistance.FromOhms(resistance);
Assert.Equal(expected, potential.Volts);
}
+
+ [Fact]
+ public void ElectricCurrentMultipliedByElectricPotentialEqualsPower()
+ {
+ Power p = ElectricCurrent.FromAmperes(2) * ElectricPotential.FromVolts(10);
+ Assert.Equal(20, p.Watts);
+ }
}
}
diff --git a/UnitsNet.Tests/CustomCode/ElectricPotentialTests.cs b/UnitsNet.Tests/CustomCode/ElectricPotentialTests.cs
index 4e27fe901e..0fb87452fc 100644
--- a/UnitsNet.Tests/CustomCode/ElectricPotentialTests.cs
+++ b/UnitsNet.Tests/CustomCode/ElectricPotentialTests.cs
@@ -40,5 +40,12 @@ public void ElectricPotentialDividedByElectricResistanceEqualsElectricCurrent(fl
ElectricCurrent current = ElectricPotential.FromVolts(potential) / ElectricResistance.FromOhms(resistance);
Assert.Equal(expected, current.Amperes);
}
+
+ [Fact]
+ public void ElectricPotentialMultipliedByElectricCurrentEqualsPower()
+ {
+ Power p = ElectricPotential.FromVolts(10) * ElectricCurrent.FromAmperes(2);
+ Assert.Equal(20, p.Watts);
+ }
}
}
diff --git a/UnitsNet.Tests/CustomCode/PowerTests.cs b/UnitsNet.Tests/CustomCode/PowerTests.cs
index 45821fdb81..03f5d72b24 100644
--- a/UnitsNet.Tests/CustomCode/PowerTests.cs
+++ b/UnitsNet.Tests/CustomCode/PowerTests.cs
@@ -127,5 +127,19 @@ public void PowerDividedBySpecificEnergyEqualsMassFlow()
MassFlow massFlow = Power.FromWatts(15.0) / SpecificEnergy.FromJoulesPerKilogram(3);
Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(5));
}
+
+ [Fact]
+ public void PowerDividedByElectricCurrentEqualsElectricPotential()
+ {
+ ElectricPotential u = Power.FromWatts(10) / ElectricCurrent.FromAmperes(2);
+ Assert.Equal(5, u.Volts);
+ }
+
+ [Fact]
+ public void PowerDividedByElectricPotentialEqualsElectricCurrent()
+ {
+ ElectricCurrent i = Power.FromWatts(20) / ElectricPotential.FromVolts(5);
+ Assert.Equal(4, i.Amperes);
+ }
}
}
diff --git a/UnitsNet/CustomCode/Quantities/ElectricCurrent.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricCurrent.extra.cs
index 261edea0c2..139f5bc40a 100644
--- a/UnitsNet/CustomCode/Quantities/ElectricCurrent.extra.cs
+++ b/UnitsNet/CustomCode/Quantities/ElectricCurrent.extra.cs
@@ -11,5 +11,12 @@ public partial struct ElectricCurrent
{
return ElectricPotential.FromVolts(resistance.Ohms * current.Amperes);
}
+
+ /// Calculate from multiplied by .
+ /// Electric power is defined as P = U * I.
+ public static Power operator *(ElectricCurrent current, ElectricPotential potential)
+ {
+ return Power.FromWatts(potential.Volts * current.Amperes);
+ }
}
}
diff --git a/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs
index 78e15c5fd8..d006828077 100644
--- a/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs
+++ b/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs
@@ -32,5 +32,12 @@ public AmplitudeRatio ToAmplitudeRatio()
{
return ElectricCurrent.FromAmperes(potential.Volts / resistance.Ohms);
}
+
+ /// Calculate from multiplied by .
+ /// Electric power is defined as P = U * I.
+ public static Power operator *(ElectricPotential potential, ElectricCurrent current)
+ {
+ return Power.FromWatts(potential.Volts * current.Amperes);
+ }
}
}
diff --git a/UnitsNet/CustomCode/Quantities/Power.extra.cs b/UnitsNet/CustomCode/Quantities/Power.extra.cs
index 4b61a19b76..187c2740fc 100644
--- a/UnitsNet/CustomCode/Quantities/Power.extra.cs
+++ b/UnitsNet/CustomCode/Quantities/Power.extra.cs
@@ -92,5 +92,19 @@ public PowerRatio ToPowerRatio()
{
return Area.FromSquareMeters( power.Watts / heatFlux.WattsPerSquareMeter );
}
+
+ /// Calculate from divided by .
+ /// Electric power is defined as P = U * I, so I = P / U.
+ public static ElectricCurrent operator /(Power power, ElectricPotential potential)
+ {
+ return ElectricCurrent.FromAmperes(power.Watts / potential.Volts);
+ }
+
+ /// Calculate from divided by .
+ /// Electric power is defined as P = U * I, so I = P / U.
+ public static ElectricPotential operator /(Power power, ElectricCurrent current)
+ {
+ return ElectricPotential.FromVolts(power.Watts / current.Amperes);
+ }
}
}