Refactor common CatalogUtils step 2 72/101972/5
authorguillaume.lambert <guillaume.lambert@orange.com>
Fri, 5 Aug 2022 14:36:18 +0000 (16:36 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Tue, 9 Aug 2022 10:00:14 +0000 (12:00 +0200)
commit39661531e7b39e598d08372e744477a92b466add
tree763bdbd0813ff128c3badc1fe1eddef14d6e5c4c
parentfdd755e13cecd07f67e7398b8d9546937fc63e23
Refactor common CatalogUtils step 2

Improve getPceRoadmAmpParameters method implementation
- remove useless intermediate variables
- fix Interchannel spacing correction factor in OSNR calculation
  ADD case formula (forgotten 10 factor).
- introduce a list for OSNR computation polynomial factors  and review
  order of arithmetic operations with a for-loop for more precision
  and efficiency.
  Double is not strictly spoken a Mathematics commutative group because
  computers design limits their bits representation size.
  As a result, the order of arithmetic operation matters.
  In a sum, smallest numbers should be introduced first for a maximum of
  precision. In other words, the sum
      10 * Math.log10(spacing / 50.0)
      + osnrPolynomialFits.get(0)
      + osnrPolynomialFits.get(1) * pwrIn
      + osnrPolynomialFits.get(2) * Math.pow(pwrIn, 2)
      + osnrPolynomialFits.get(3) * Math.pow(pwrIn, 3)
  is not equal to its reverse form
      osnrPolynomialFits.get(3) * Math.pow(pwrIn, 3)
      + osnrPolynomialFits.get(2) * Math.pow(pwrIn, 2)
      + osnrPolynomialFits.get(1) * pwrIn
      + osnrPolynomialFits.get(0)
      + 10 * Math.log10(spacing / 50.0)
  and the more precise first form should be preferred here.
- Adapt comments and Junit tests accordingly

JIRA: TRNSPRTPCE-518
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I7dcf500eb7ff93aacfe594dbe2d6e6125dab2e03
common/src/main/java/org/opendaylight/transportpce/common/catalog/CatalogUtils.java
common/src/test/java/org/opendaylight/transportpce/common/catalog/CatalogUtilsTest.java