UcteNode implements UcteRecord, Comparable<UcteNode> { @Override public void fix() { if (isGenerator()) { fixActivePower(); fixVoltage(); fixReactivePower(); } } UcteNode(UcteNodeCode code, String geographicalName, UcteNodeStatus status, UcteNodeTypeCode typeCode,
                    float voltageReference, float activeLoad, float reactiveLoad, float activePowerGeneration,
                    float reactivePowerGeneration, float minimumPermissibleActivePowerGeneration,
                    float maximumPermissibleActivePowerGeneration, float minimumPermissibleReactivePowerGeneration,
                    float maximumPermissibleReactivePowerGeneration, float staticOfPrimaryControl,
                    float nominalPowerPrimaryControl, float threePhaseShortCircuitPower, float xrRatio,
                    UctePowerPlantType powerPlantType); UcteNodeCode getCode(); void setCode(UcteNodeCode code); String getGeographicalName(); void setGeographicalName(String geographicalName); UcteNodeStatus getStatus(); void setStatus(UcteNodeStatus status); UcteNodeTypeCode getTypeCode(); void setTypeCode(UcteNodeTypeCode typeCode); float getVoltageReference(); void setVoltageReference(float voltageReference); float getActiveLoad(); void setActiveLoad(float activeLoad); float getReactiveLoad(); void setReactiveLoad(float reactiveLoad); float getActivePowerGeneration(); void setActivePowerGeneration(float activePowerGeneration); float getReactivePowerGeneration(); void setReactivePowerGeneration(float reactivePowerGeneration); float getMinimumPermissibleActivePowerGeneration(); void setMinimumPermissibleActivePowerGeneration(float minimumPermissibleActivePowerGeneration); float getMaximumPermissibleActivePowerGeneration(); void setMaximumPermissibleActivePowerGeneration(float maximumPermissibleActivePowerGeneration); float getMinimumPermissibleReactivePowerGeneration(); void setMinimumPermissibleReactivePowerGeneration(float minimumPermissibleReactivePowerGeneration); float getMaximumPermissibleReactivePowerGeneration(); void setMaximumPermissibleReactivePowerGeneration(float maximumPermissibleReactivePowerGeneration); float getStaticOfPrimaryControl(); void setStaticOfPrimaryControl(float staticOfPrimaryControl); float getNominalPowerPrimaryControl(); void setNominalPowerPrimaryControl(float nominalPowerPrimaryControl); float getThreePhaseShortCircuitPower(); void setThreePhaseShortCircuitPower(float threePhaseShortCircuitPower); float getXrRatio(); void setXrRatio(float xrRatio); UctePowerPlantType getPowerPlantType(); void setPowerPlantType(UctePowerPlantType powerPlantType); boolean isGenerator(); boolean isRegulatingVoltage(); boolean isRegulatingFrequency(); @Override void fix(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(UcteNode ucteNode);  }
@Test public void testFix() { UcteNode node = createNode(); node.setTypeCode(UcteNodeTypeCode.UT); node.setTypeCode(UcteNodeTypeCode.UT); node.setMinimumPermissibleActivePowerGeneration(-1000.0f); node.setMaximumPermissibleActivePowerGeneration(1000.0f); node.setMinimumPermissibleReactivePowerGeneration(-2000.0f); node.setMaximumPermissibleReactivePowerGeneration(2000.0f); node.fix(); assertEquals(1000.0f, node.getMinimumPermissibleActivePowerGeneration(), 0.0f); assertEquals(-1000.0f, node.getMaximumPermissibleActivePowerGeneration(), 0.0f); assertEquals(2000.0f, node.getMinimumPermissibleReactivePowerGeneration(), 0.0f); assertEquals(-2000.0f, node.getMaximumPermissibleReactivePowerGeneration(), 0.0f); node = createNode(); node.setTypeCode(UcteNodeTypeCode.UT); node.setActivePowerGeneration(10.0f); node.setReactivePowerGeneration(10.0f); node.setMinimumPermissibleActivePowerGeneration(0.0f); node.setMinimumPermissibleReactivePowerGeneration(0.0f); node.fix(); assertEquals(node.getActivePowerGeneration(), node.getMinimumPermissibleActivePowerGeneration(), 0.0f); assertEquals(node.getReactivePowerGeneration(), node.getMinimumPermissibleReactivePowerGeneration(), 0.0f); node = createNode(); node.setTypeCode(UcteNodeTypeCode.UT); node.setActivePowerGeneration(0.0f); node.setReactivePowerGeneration(0.0f); node.setMaximumPermissibleActivePowerGeneration(10.0f); node.setMaximumPermissibleReactivePowerGeneration(10.0f); node.fix(); assertEquals(node.getActivePowerGeneration(), node.getMaximumPermissibleActivePowerGeneration(), 0.0f); assertEquals(node.getReactivePowerGeneration(), node.getMaximumPermissibleReactivePowerGeneration(), 0.0f); node = createNode(); node.setTypeCode(UcteNodeTypeCode.UT); node.setReactivePowerGeneration(0.0f); node.setMinimumPermissibleReactivePowerGeneration(0.0f); node.setMaximumPermissibleReactivePowerGeneration(0.0f); node.fix(); assertEquals(9999.0f, node.getMinimumPermissibleReactivePowerGeneration(), 0.0f); assertEquals(-9999.0f, node.getMaximumPermissibleReactivePowerGeneration(), 0.0f); node.setTypeCode(UcteNodeTypeCode.UT); node.setReactivePowerGeneration(0.0f); node.setMinimumPermissibleReactivePowerGeneration(10000.0f); node.setMaximumPermissibleReactivePowerGeneration(-10000.0f); node.fix(); }