New API for GNPy
[transportpce.git] / common / src / main / java / org / opendaylight / transportpce / common / fixedflex / GridUtils.java
index a38897eaac8e851e90998f285d88a7e380068f6e..efbe2034ba4c97c4efbecbefbea19b5af7c03431 100644 (file)
@@ -221,4 +221,13 @@ public final class GridUtils {
         return frequencyIndex - 284;
     }
 
+    /**
+     * Convert the power from dBm to Watt.
+     * @param  dbm power in dBm.
+     * @return outputpower in Watt.
+     */
+    public static BigDecimal convertDbmW(double dbm) {
+        return BigDecimal.valueOf(Math.pow(10, (dbm - 30) / 10));
+    }
+
 }