- LOG.debug("Input Gridsize is {}",input.getMcWidth().getValue());
- if (input.getMcWidth().getValue().equals(GridConstant.WIDTH_80)) {
- powerValue = powerValue.add(BigDecimal.valueOf(3));
- } else if (input.getMcWidth().getValue().equals(GridConstant.SLOT_WIDTH_87_5)) {
- BigDecimal logVal = GridConstant.SLOT_WIDTH_87_5.divide(new BigDecimal(50));
- double pdsVal = 10 * Math.log10(logVal.doubleValue());
- powerValue = powerValue.add(new BigDecimal(pdsVal, new MathContext(3, RoundingMode.HALF_EVEN)));
- }
+ // Units of MC-width are in GHz, meaning it should be 40/50/87.5GHz
+ // TODO: Should we validate this units before proceeding?
+ LOG.debug("Input Grid size is {}", input.getMcWidth().getValue());
+
+ // We round-off the mc-width to the nearest grid-value based on the granularity of 12.5 GHz
+ double nbrMcSlots = Math.ceil(input.getMcWidth().getValue().doubleValue() / MC_WIDTH_GRAN);
+ LOG.debug("Nearest (ceil) number of slots {}", nbrMcSlots);
+ mcWidth = new BigDecimal(MC_WIDTH_GRAN * nbrMcSlots);
+ LOG.debug("Given mc-width={}, Rounded mc-width={}", input.getMcWidth().getValue(), mcWidth);
+
+ BigDecimal logVal = mcWidth.divide(new BigDecimal(50));
+ double pdsVal = 10 * Math.log10(logVal.doubleValue());
+ // Addition of PSD value will give Pin[87.5 GHz]
+ powerValue = powerValue.add(new BigDecimal(pdsVal, new MathContext(3, RoundingMode.HALF_EVEN)));