+ LOG.info("Did not succeed finding network TP {} in Configuration Datastore. Retrieve"
+ + " default Operational Mode {} from serviceType {}", nwTpId, opMode, serviceType);
+ return opMode;
+ }
+
+ private double getLastXpdrMargin(
+ CatalogUtils cu, Map<String, Double> signal,
+ String nwTpId, String serviceType, PceNode currentNode, String vertice, int pathElement) {
+ LOG.debug("Loop Path Element = {}, Step5.1, XPDR, tries calculating Margin, just before call", pathElement);
+ // Check that accumulated degradations are compatible with TSP performances
+ // According to OpenROADM spec :
+ // margin = cu.getPceRxTspParameters(opMode, calcCd, Math.sqrt(calcPmd2), Math.sqrt(calcPdl2),
+ // getOsnrDbfromOnsrLin(calcOnsrLin));
+ // Calculation modified for pdl according to calculation in Julia's Tool
+ double calcOnsrdB = getOsnrDbfromOnsrLin(signal.get("calcOnsrLin").doubleValue());
+ LOG.info("Loop Path Element = {}, XPDR, calcosnrdB= {}", pathElement, calcOnsrdB);
+ return cu.getPceRxTspParameters(
+ getXpdrOpMode(nwTpId, vertice, pathElement, currentNode, serviceType, cu),
+ signal.get("calcCd").doubleValue(),
+ Math.sqrt(signal.get("calcPmd2").doubleValue()),
+ Math.sqrt(signal.get("calcPdl2").doubleValue()),
+ calcOnsrdB);
+ }
+
+ private void calcXpdrOSNR(
+ CatalogUtils cu, Map<String, Double> signal, String nwTpId, String serviceType,
+ PceNode currentNode, PceNode nextNode, String vertice, int pathElement) {
+ // If the Xponder operational mode (setOpMode Arg1) is not consistent nor declared in the topology (Network TP)
+ // Operational mode is retrieved from the service Type assuming it is supported by the Xponder (setOpMode Arg2)
+ String opMode = getXpdrOpMode(nwTpId, vertice, pathElement, currentNode, serviceType, cu);
+ // If the operational mode of the ADD/DROP MUX is not consistent nor declared in the topology (Network TP)
+ // Operational mode is set by default to standard opMode for ADD SRGs
+ String adnMode = setOpMode(nextNode.getOperationalMode(), CatalogConstant.MWWRCORE);
+ double calcOnsrLin = cu.getPceTxTspParameters(opMode, adnMode);
+ LOG.debug(
+ "Transponder {} corresponding to path Element {} is connected to SRG which has {} operational mode",
+ currentNode.getNodeId().getValue(), pathElement, adnMode);
+ LOG.info("Transponder {} corresponding to path Element {} in the path has a TX OSNR of {} dB",
+ currentNode.getNodeId().getValue(), pathElement, getOsnrDbfromOnsrLin(calcOnsrLin));
+ // Return the Tx ONSR of the Xponder which results from IB and OOB OSNR contributions
+ // and the spacing associated with Xponder operational mode that is needed to calculate OSNR
+ signal.put("spacing", Double.valueOf(cu.getPceTxTspChannelSpacing(opMode)));
+ signal.put("calcOnsrLin", Double.valueOf(calcOnsrLin));
+ }
+
+ private void calcDropContrib(
+ CatalogUtils cu, Map<String, Double> signal, PceNode currentNode, PceLink pceLink) {
+ //calculation of the SRG contribution for Drop
+ calcLineDegradation(cu, signal, pceLink);
+ Map<String, Double> impairments = cu.getPceRoadmAmpParameters(
+ CatalogConstant.CatalogNodeType.DROP,
+ setOpMode(currentNode.getOperationalMode(), CatalogConstant.MWWRCORE),
+ // If the operational mode of the ADD/DROP MUX is not consistent or not declared in the topology (Network TP)
+ // Operational mode is set by default to standard opMode for ADD/DROP SRGs
+ signal.get("pwrIn").doubleValue(),
+ signal.get("calcCd").doubleValue(),
+ signal.get("calcPmd2").doubleValue(),
+ signal.get("calcPdl2").doubleValue(),
+ signal.get("calcOnsrLin").doubleValue(),
+ signal.get("spacing").doubleValue());
+ signal.putAll(
+ Map.of(
+ "calcCd", impairments.get("CD"),
+ "calcPmd2", impairments.get("DGD2"),
+ "calcPdl2", impairments.get("PDL2"),
+ "calcOnsrLin", impairments.get("ONSRLIN")));
+ }
+
+ private void calcAddContrib(
+ CatalogUtils cu, Map<String, Double> signal, PceNode currentNode, PceLink pceLink) {
+ //calculation of the SRG contribution for Add
+ String srgMode = setOpMode(currentNode.getOperationalMode(), CatalogConstant.MWWRCORE);
+ // If the operational mode of the ADD/DROP MUX is not consistent or is not declared in the topology (Network TP)
+ // Operational mode is set by default to standard opMode for ADD/DROP SRGs
+ CatalogNodeType cnt = CatalogConstant.CatalogNodeType.ADD;
+ double pwrOut = cu.getPceRoadmAmpOutputPower(
+ cnt, srgMode, pceLink.getspanLoss(), signal.get("spacing").doubleValue(), pceLink.getpowerCorrection());
+ //calculation of the SRG contribution either for Add and Drop
+ Map<String, Double> impairments = cu.getPceRoadmAmpParameters(cnt, srgMode, 0,
+ signal.get("calcCd").doubleValue(), signal.get("calcPmd2").doubleValue(),
+ signal.get("calcPdl2").doubleValue(),
+ signal.get("calcOnsrLin").doubleValue(), signal.get("spacing").doubleValue());
+ signal.putAll(
+ Map.of(
+ "calcCd", impairments.get("CD"),
+ "calcPmd2", impairments.get("DGD2"),
+ "calcPdl2", impairments.get("PDL2"),
+ "calcOnsrLin", impairments.get("ONSRLIN"),
+ "pwrOut", Double.valueOf(pwrOut)));
+ }
+
+ private void calcBypassContrib(CatalogUtils cu, Map<String, Double> signal,
+ PceNode currentNode, PceNode nextNode, PceLink pceLink0, PceLink pceLink1) {
+ // If the operational mode of the Degree is not consistent or declared in the topology
+ // Operational mode is set by default to standard opMode for Degree
+ String degree1Mode = setOpMode(currentNode.getOperationalMode(), CatalogConstant.MWMWCORE);
+ // Same for next node which is the second degree of a ROADM node
+ String degree2Mode = setOpMode(nextNode.getOperationalMode(), CatalogConstant.MWMWCORE);
+ // At that time OpenROADM provides only one spec for the ROADM nodes
+ if (!degree1Mode.equals(degree2Mode)) {
+ LOG.warn("Unsupported Hybrid ROADM configuration with Degree1 {} of {} operational mode and Degree2 "
+ + "{} of {} operational mode. Will by default use operational mode of Degree2",
+ currentNode.getNodeId(), degree1Mode, nextNode.getNodeId(), degree2Mode);
+ }
+ calcLineDegradation(cu, signal, pceLink0);
+ CatalogNodeType cnt = CatalogConstant.CatalogNodeType.EXPRESS;
+ double pwrOut = cu.getPceRoadmAmpOutputPower(cnt, degree2Mode, pceLink1.getspanLoss(),
+ signal.get("spacing").doubleValue(), pceLink1.getpowerCorrection());
+ // Adds to accumulated impairments the degradation associated with the Express
+ // path of ROADM : Degree1, express link, Degree2
+ Map<String, Double> impairments = cu.getPceRoadmAmpParameters(cnt, degree2Mode,
+ signal.get("pwrIn").doubleValue(), signal.get("calcCd").doubleValue(),
+ signal.get("calcPmd2").doubleValue(), signal.get("calcPdl2").doubleValue(),
+ signal.get("calcOnsrLin").doubleValue(), signal.get("spacing").doubleValue());
+ signal.putAll(
+ Map.of(
+ "calcCd", impairments.get("CD"),
+ "calcPmd2", impairments.get("DGD2"),
+ "calcPdl2", impairments.get("PDL2"),
+ "calcOnsrLin", impairments.get("ONSRLIN"),
+ "pwrOut", Double.valueOf(pwrOut)));
+ }
+ //TODO these methods might be more indicated in a catalog utils refactoring
+
+ private void calcLineDegradation(CatalogUtils cu, Map<String, Double> signal, PceLink pceLink) {
+ // Calculate degradation accumulated across incoming Link and add them to
+ // accumulated impairments
+ // This also includes Non Linear Contribution from the path
+ signal.putAll(Map.of(
+ "pwrIn", Double.valueOf(signal.get("pwrOut").doubleValue() - pceLink.getspanLoss()),
+ "calcCd", Double.valueOf(signal.get("calcCd").doubleValue() + pceLink.getcd()),
+ "calcPmd2", Double.valueOf(signal.get("calcPmd2").doubleValue() + pceLink.getpmd2()),
+ "calcOnsrLin", Double.valueOf(
+ signal.get("calcOnsrLin").doubleValue()
+ + cu.calculateNLonsrContribution(
+ signal.get("pwrOut").doubleValue(), pceLink.getLength(), signal.get("spacing").doubleValue()))));