diff --git a/src/main/java/org/gridsuite/network/map/config/NetworkMapJsonConfig.java b/src/main/java/org/gridsuite/network/map/config/NetworkMapJsonConfig.java new file mode 100644 index 00000000..453d55a4 --- /dev/null +++ b/src/main/java/org/gridsuite/network/map/config/NetworkMapJsonConfig.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2025, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package org.gridsuite.network.map.config; + +import org.gridsuite.network.map.config.nan.NaNAsNullModule; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author Thang PHAM + */ +@Configuration +public class NetworkMapJsonConfig { + @Bean + public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() { + return builder -> builder + .modulesToInstall(new NaNAsNullModule()); + } +} diff --git a/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullDoubleSerializer.java b/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullDoubleSerializer.java new file mode 100644 index 00000000..bde30be7 --- /dev/null +++ b/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullDoubleSerializer.java @@ -0,0 +1,19 @@ +package org.gridsuite.network.map.config.nan; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class NaNAsNullDoubleSerializer extends JsonSerializer { + + @Override + public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + if (value == null || value.isNaN()) { + gen.writeNull(); + } else { + gen.writeNumber(value); + } + } +} diff --git a/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullFloatSerializer.java b/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullFloatSerializer.java new file mode 100644 index 00000000..3ff067b5 --- /dev/null +++ b/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullFloatSerializer.java @@ -0,0 +1,19 @@ +package org.gridsuite.network.map.config.nan; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class NaNAsNullFloatSerializer extends JsonSerializer { + + @Override + public void serialize(Float value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + if (value == null || value.isNaN()) { + gen.writeNull(); + } else { + gen.writeNumber(value); + } + } +} diff --git a/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullModule.java b/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullModule.java new file mode 100644 index 00000000..c9c68a23 --- /dev/null +++ b/src/main/java/org/gridsuite/network/map/config/nan/NaNAsNullModule.java @@ -0,0 +1,10 @@ +package org.gridsuite.network.map.config.nan; + +import com.fasterxml.jackson.databind.module.SimpleModule; + +public class NaNAsNullModule extends SimpleModule { + public NaNAsNullModule() { + this.addSerializer(Double.class, new NaNAsNullDoubleSerializer()) + .addSerializer(Float.class, new NaNAsNullFloatSerializer()); + } +} diff --git a/src/main/java/org/gridsuite/network/map/config/nan/NullAndNaNFilter.java b/src/main/java/org/gridsuite/network/map/config/nan/NullAndNaNFilter.java new file mode 100644 index 00000000..e775396f --- /dev/null +++ b/src/main/java/org/gridsuite/network/map/config/nan/NullAndNaNFilter.java @@ -0,0 +1,21 @@ +package org.gridsuite.network.map.config.nan; + +public class NullAndNaNFilter { + + @Override + public boolean equals(Object value) { + if (value == null) { + return true; // Ignore null + } else if (value instanceof Double doubleValue && doubleValue.isNaN()) { + return true; // Ignore NaN + } else if (value instanceof Float floatValue && floatValue.isNaN()) { + return true; // Ignore NaN + } + return false; + } + + @Override + public int hashCode() { + return 0; // 0 due to not important + } +} diff --git a/src/main/java/org/gridsuite/network/map/dto/common/CurrentLimitsData.java b/src/main/java/org/gridsuite/network/map/dto/common/CurrentLimitsData.java index 1fb636cc..2c586e2d 100644 --- a/src/main/java/org/gridsuite/network/map/dto/common/CurrentLimitsData.java +++ b/src/main/java/org/gridsuite/network/map/dto/common/CurrentLimitsData.java @@ -10,6 +10,7 @@ import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import java.util.List; @@ -25,7 +26,7 @@ public class CurrentLimitsData { @JsonInclude(JsonInclude.Include.NON_NULL) private String id; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double permanentLimit; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/common/MinMaxReactiveLimitsMapData.java b/src/main/java/org/gridsuite/network/map/dto/common/MinMaxReactiveLimitsMapData.java index ffbf95de..1158cf94 100644 --- a/src/main/java/org/gridsuite/network/map/dto/common/MinMaxReactiveLimitsMapData.java +++ b/src/main/java/org/gridsuite/network/map/dto/common/MinMaxReactiveLimitsMapData.java @@ -11,6 +11,7 @@ import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Seddik Yengui @@ -21,9 +22,9 @@ @EqualsAndHashCode public class MinMaxReactiveLimitsMapData { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double minQ; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double maxQ; } diff --git a/src/main/java/org/gridsuite/network/map/dto/common/TapChangerData.java b/src/main/java/org/gridsuite/network/map/dto/common/TapChangerData.java index d770c793..764a0a4d 100644 --- a/src/main/java/org/gridsuite/network/map/dto/common/TapChangerData.java +++ b/src/main/java/org/gridsuite/network/map/dto/common/TapChangerData.java @@ -8,7 +8,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.powsybl.iidm.network.PhaseTapChanger; -import lombok.*; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import java.util.List; @@ -31,16 +34,16 @@ public class TapChangerData { @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean hasLoadTapChangingCapabilities; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetV; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetDeadband; @JsonInclude(JsonInclude.Include.NON_NULL) private PhaseTapChanger.RegulationMode regulationMode; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double regulationValue; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/common/TapChangerStepData.java b/src/main/java/org/gridsuite/network/map/dto/common/TapChangerStepData.java index 304e758f..ac41705a 100644 --- a/src/main/java/org/gridsuite/network/map/dto/common/TapChangerStepData.java +++ b/src/main/java/org/gridsuite/network/map/dto/common/TapChangerStepData.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.*; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Hugo Marcellin @@ -19,22 +20,22 @@ public class TapChangerStepData { @JsonInclude(JsonInclude.Include.NON_NULL) private Integer index; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double rho; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double r; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double x; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double g; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double alpha; } diff --git a/src/main/java/org/gridsuite/network/map/dto/common/TemporaryLimitData.java b/src/main/java/org/gridsuite/network/map/dto/common/TemporaryLimitData.java index 3c5e1a74..d5f90c0c 100644 --- a/src/main/java/org/gridsuite/network/map/dto/common/TemporaryLimitData.java +++ b/src/main/java/org/gridsuite/network/map/dto/common/TemporaryLimitData.java @@ -10,6 +10,7 @@ import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author David Braquart @@ -20,7 +21,7 @@ public class TemporaryLimitData { private String name; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double value; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/battery/BatteryFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/battery/BatteryFormInfos.java index d38e1455..ad60000d 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/battery/BatteryFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/battery/BatteryFormInfos.java @@ -9,11 +9,12 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; -import org.gridsuite.network.map.dto.definition.extension.ActivePowerControlInfos; -import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; import org.gridsuite.network.map.dto.common.ReactiveCapabilityCurveMapData; +import org.gridsuite.network.map.dto.definition.extension.ActivePowerControlInfos; +import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import java.util.List; import java.util.Optional; @@ -27,15 +28,15 @@ public class BatteryFormInfos extends ElementInfosWithProperties { private String voltageLevelId; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; private Double targetP; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetQ; private Double minP; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/battery/BatteryTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/battery/BatteryTabInfos.java index 733a609e..5bd35494 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/battery/BatteryTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/battery/BatteryTabInfos.java @@ -10,11 +10,12 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; -import org.gridsuite.network.map.dto.definition.extension.ActivePowerControlInfos; -import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; import org.gridsuite.network.map.dto.common.ReactiveCapabilityCurveMapData; +import org.gridsuite.network.map.dto.definition.extension.ActivePowerControlInfos; +import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.extension.InjectionObservabilityInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; @@ -30,15 +31,15 @@ public class BatteryTabInfos extends ElementInfosWithProperties { private String voltageLevelId; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; private Double targetP; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetQ; private Double minP; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/danglingline/DanglingLineTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/danglingline/DanglingLineTabInfos.java index 5adde26c..65c2bdca 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/danglingline/DanglingLineTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/danglingline/DanglingLineTabInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.InjectionObservabilityInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; @@ -36,19 +37,19 @@ public class DanglingLineTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private String pairingKey; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p0; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q0; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/ActivePowerControlInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/ActivePowerControlInfos.java index 18ffabfc..b028be7a 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/ActivePowerControlInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/ActivePowerControlInfos.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Souissi Maissa @@ -15,7 +16,7 @@ public class ActivePowerControlInfos { @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean participate; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double droop; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/CoordinatedReactiveControlInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/CoordinatedReactiveControlInfos.java index ee04aafd..5b380348 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/CoordinatedReactiveControlInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/CoordinatedReactiveControlInfos.java @@ -5,6 +5,7 @@ import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Souissi Maissa @@ -16,10 +17,10 @@ public class CoordinatedReactiveControlInfos { // As this attribute has only one lower case letter at its start (xXXXX), the getters is parsed as getQPercent and the field for Jackson is parsed as qpercent // while we expect qPercent. JsonProperty let fix the json field to qPercent - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) @JsonProperty("qPercent") @Getter(AccessLevel.NONE) - private double qPercent; + private Double qPercent; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/GeneratorShortCircuitInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/GeneratorShortCircuitInfos.java index c92f876e..ca73d901 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/GeneratorShortCircuitInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/GeneratorShortCircuitInfos.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Souissi Maissa @@ -12,10 +13,10 @@ @Builder public class GeneratorShortCircuitInfos { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double directTransX; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double stepUpTransformerX; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/GeneratorStartupInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/GeneratorStartupInfos.java index 1c86e1f4..04bc12ec 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/GeneratorStartupInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/GeneratorStartupInfos.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Souissi Maissa @@ -11,15 +12,15 @@ @Getter @Builder public class GeneratorStartupInfos { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double plannedActivePowerSetPoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double marginalCost; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double plannedOutageRate; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double forcedOutageRate; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/HvdcAngleDroopActivePowerControlInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/HvdcAngleDroopActivePowerControlInfos.java index c0d58181..db32c548 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/HvdcAngleDroopActivePowerControlInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/HvdcAngleDroopActivePowerControlInfos.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Souissi Maissa @@ -12,12 +13,12 @@ @Builder public class HvdcAngleDroopActivePowerControlInfos { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float droop; @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean isEnabled; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float p0; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/HvdcOperatorActivePowerRangeInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/HvdcOperatorActivePowerRangeInfos.java index 7d3c92ea..1c5d8e51 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/HvdcOperatorActivePowerRangeInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/HvdcOperatorActivePowerRangeInfos.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Souissi Maissa @@ -12,9 +13,9 @@ @Builder public class HvdcOperatorActivePowerRangeInfos { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float oprFromCS1toCS2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float oprFromCS2toCS1; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/IdentifiableShortCircuitInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/IdentifiableShortCircuitInfos.java index 53713105..cc5ea421 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/IdentifiableShortCircuitInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/IdentifiableShortCircuitInfos.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Souissi Maissa @@ -12,10 +13,10 @@ @Builder public class IdentifiableShortCircuitInfos { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double ipMin; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double ipMax; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/MeasurementsInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/MeasurementsInfos.java index 11fa5472..5f53323e 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/MeasurementsInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/MeasurementsInfos.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Franck Lecuyer @@ -17,7 +18,7 @@ @Getter @Builder public class MeasurementsInfos { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double value; private boolean validity; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/ObservabilityQualityInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/ObservabilityQualityInfos.java index 2b37af6a..204ffe13 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/ObservabilityQualityInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/ObservabilityQualityInfos.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Achour Berrahma @@ -18,7 +19,8 @@ @Builder public class ObservabilityQualityInfos { - private double standardDeviation; + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) + private Double standardDeviation; @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean isRedundant; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/extension/StandbyAutomatonInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/extension/StandbyAutomatonInfos.java index 67241017..e7fe18b6 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/extension/StandbyAutomatonInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/extension/StandbyAutomatonInfos.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; import lombok.Getter; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; /** * @author Rehili Ghazwa @@ -20,19 +21,19 @@ public class StandbyAutomatonInfos { @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean standby; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b0; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double lowVoltageSetpoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double highVoltageSetpoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double lowVoltageThreshold; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double highVoltageThreshold; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/generator/GeneratorFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/generator/GeneratorFormInfos.java index 90541826..c9f69818 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/generator/GeneratorFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/generator/GeneratorFormInfos.java @@ -10,10 +10,11 @@ import com.powsybl.iidm.network.EnergySource; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; -import org.gridsuite.network.map.dto.definition.extension.*; import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; import org.gridsuite.network.map.dto.common.ReactiveCapabilityCurveMapData; +import org.gridsuite.network.map.dto.definition.extension.*; import java.util.List; import java.util.Optional; @@ -31,18 +32,18 @@ public class GeneratorFormInfos extends ElementInfosWithProperties { private Boolean terminalConnected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; private Double targetP; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetQ; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetV; private Double minP; @@ -52,7 +53,7 @@ public class GeneratorFormInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private EnergySource energySource; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double ratedS; private boolean voltageRegulatorOn; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/generator/GeneratorTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/generator/GeneratorTabInfos.java index a3e4aaf7..ef012b33 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/generator/GeneratorTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/generator/GeneratorTabInfos.java @@ -11,10 +11,11 @@ import com.powsybl.iidm.network.EnergySource; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; -import org.gridsuite.network.map.dto.definition.extension.*; import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; import org.gridsuite.network.map.dto.common.ReactiveCapabilityCurveMapData; +import org.gridsuite.network.map.dto.definition.extension.*; import java.util.List; import java.util.Map; @@ -38,18 +39,18 @@ public class GeneratorTabInfos extends ElementInfosWithProperties { private Boolean terminalConnected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; private Double targetP; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetQ; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetV; private Double minP; @@ -59,7 +60,7 @@ public class GeneratorTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private EnergySource energySource; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double ratedS; private boolean voltageRegulatorOn; @@ -116,10 +117,10 @@ public class GeneratorTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private String voltageLevelName; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double lowVoltageLimit; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double highVoltageLimit; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcFormInfos.java index f2e7dcaa..26840364 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcFormInfos.java @@ -11,6 +11,7 @@ import com.powsybl.iidm.network.HvdcLine; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; /** @@ -23,16 +24,16 @@ public class HvdcFormInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private HvdcLine.ConvertersMode convertersMode; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double r; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double nominalV; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double activePowerSetpoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double maxP; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcMapInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcMapInfos.java index 6259bf91..d7cdf267 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcMapInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcMapInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.HvdcConverterStation; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfos; /** @@ -30,10 +31,10 @@ public class HvdcMapInfos extends ElementInfos { @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcShuntCompensatorsInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcShuntCompensatorsInfos.java index 94018a49..e6a7ffcb 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcShuntCompensatorsInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcShuntCompensatorsInfos.java @@ -35,7 +35,7 @@ public class HvdcShuntCompensatorsInfos { public static class ShuntCompensatorInfos { private String id; private String name; - private double maxQAtNominalV; + private Double maxQAtNominalV; private boolean connectedToHvdc; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcTabInfos.java index d45d880e..7bac1c20 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/hvdc/HvdcTabInfos.java @@ -11,6 +11,7 @@ import com.powsybl.iidm.network.HvdcLine; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.HvdcAngleDroopActivePowerControlInfos; import org.gridsuite.network.map.dto.definition.extension.HvdcOperatorActivePowerRangeInfos; @@ -37,7 +38,7 @@ public class HvdcTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private String converterStationId2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double r; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -46,16 +47,16 @@ public class HvdcTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private Country country2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double activePowerSetpoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double maxP; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/lccconverterstation/LccConverterStationFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/lccconverterstation/LccConverterStationFormInfos.java index 76f8718f..bda20e36 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/lccconverterstation/LccConverterStationFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/lccconverterstation/LccConverterStationFormInfos.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.hvdc.HvdcShuntCompensatorsInfos; @@ -23,10 +24,10 @@ @SuperBuilder @Getter public class LccConverterStationFormInfos extends ElementInfos { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float powerFactor; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float lossFactor; private String voltageLevelId; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/lccconverterstation/LccConverterStationTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/lccconverterstation/LccConverterStationTabInfos.java index 57c179f3..957c4855 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/lccconverterstation/LccConverterStationTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/lccconverterstation/LccConverterStationTabInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.InjectionObservabilityInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; @@ -22,10 +23,10 @@ @SuperBuilder @Getter public class LccConverterStationTabInfos extends ElementInfosWithProperties { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float powerFactor; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float lossFactor; private String voltageLevelId; @@ -39,10 +40,10 @@ public class LccConverterStationTabInfos extends ElementInfosWithProperties { private String hvdcLineId; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/line/LineFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/line/LineFormInfos.java index f294e3df..d23b6b41 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/line/LineFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/line/LineFormInfos.java @@ -9,10 +9,12 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; -import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.common.CurrentLimitsData; +import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; + import java.util.List; import java.util.Optional; @@ -37,22 +39,22 @@ public class LineFormInfos extends ElementInfosWithProperties { private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_EMPTY) @@ -70,22 +72,22 @@ public class LineFormInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private String operatingStatus; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double r; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double x; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double g1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double g2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b2; private ConnectablePositionInfos connectablePosition1; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/line/LineMapInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/line/LineMapInfos.java index 9c260878..b6b0474c 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/line/LineMapInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/line/LineMapInfos.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.common.CurrentLimitsData; @@ -33,16 +34,16 @@ public class LineMapInfos extends ElementInfos { private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/line/LineTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/line/LineTabInfos.java index 15fb62b1..91af16b7 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/line/LineTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/line/LineTabInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.common.CurrentLimitsData; import org.gridsuite.network.map.dto.definition.extension.BranchObservabilityInfos; @@ -50,22 +51,22 @@ public class LineTabInfos extends ElementInfosWithProperties { private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_EMPTY) @@ -86,22 +87,22 @@ public class LineTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private String selectedOperationalLimitsGroup2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double r; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double x; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double g1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double g2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b2; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/line/LineTooltipInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/line/LineTooltipInfos.java index 43856653..ad792cee 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/line/LineTooltipInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/line/LineTooltipInfos.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.common.CurrentLimitsData; @@ -27,10 +28,10 @@ public class LineTooltipInfos extends ElementInfos { private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -39,16 +40,16 @@ public class LineTooltipInfos extends ElementInfos { @JsonInclude(JsonInclude.Include.NON_NULL) private CurrentLimitsData currentLimits2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double r; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double x; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b2; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/load/LoadFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/load/LoadFormInfos.java index f72be98f..171dae44 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/load/LoadFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/load/LoadFormInfos.java @@ -10,13 +10,13 @@ import com.powsybl.iidm.network.LoadType; import lombok.Getter; import lombok.experimental.SuperBuilder; - -import java.util.Optional; - +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; +import java.util.Optional; + /** * @author Slimane Amar */ @@ -30,16 +30,16 @@ public class LoadFormInfos extends ElementInfosWithProperties { private Boolean terminalConnected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p0; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q0; private ConnectablePositionInfos connectablePosition; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/load/LoadTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/load/LoadTabInfos.java index 1a26c281..870e0644 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/load/LoadTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/load/LoadTabInfos.java @@ -11,6 +11,7 @@ import com.powsybl.iidm.network.LoadType; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.extension.InjectionObservabilityInfos; @@ -36,16 +37,16 @@ public class LoadTabInfos extends ElementInfosWithProperties { private Boolean terminalConnected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p0; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q0; private ConnectablePositionInfos connectablePosition; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorFormInfos.java index 0676e8c6..967f1230 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorFormInfos.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; @@ -22,21 +23,21 @@ public class ShuntCompensatorFormInfos extends ElementInfosWithProperties { private Boolean terminalConnected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetV; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetDeadband; private Integer sectionCount; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double bPerSection; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double qAtNominalV; private Integer maximumSectionCount; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java index e2260257..aa74d78a 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.extension.InjectionObservabilityInfos; @@ -32,22 +33,22 @@ public class ShuntCompensatorTabInfos extends ElementInfosWithProperties { private Boolean terminalConnected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; private Integer sectionCount; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double maxSusceptance; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double maxQAtNominalV; private Integer maximumSectionCount; private ConnectablePositionInfos connectablePosition; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetV; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/staticvarcompensator/StaticVarCompensatorFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/staticvarcompensator/StaticVarCompensatorFormInfos.java index 4fd308be..2264536d 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/staticvarcompensator/StaticVarCompensatorFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/staticvarcompensator/StaticVarCompensatorFormInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.StaticVarCompensator; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.extension.StandbyAutomatonInfos; @@ -28,16 +29,16 @@ public class StaticVarCompensatorFormInfos extends ElementInfosWithProperties { private Boolean terminalConnected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double minSusceptance; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double maxSusceptance; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double voltageSetpoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double reactivePowerSetpoint; private StaticVarCompensator.RegulationMode regulationMode; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/staticvarcompensator/StaticVarCompensatorTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/staticvarcompensator/StaticVarCompensatorTabInfos.java index a125b007..4a1beb26 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/staticvarcompensator/StaticVarCompensatorTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/staticvarcompensator/StaticVarCompensatorTabInfos.java @@ -11,6 +11,7 @@ import com.powsybl.iidm.network.StaticVarCompensator; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.InjectionObservabilityInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; @@ -35,16 +36,16 @@ public class StaticVarCompensatorTabInfos extends ElementInfosWithProperties { private StaticVarCompensator.RegulationMode regulationMode; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double voltageSetpoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double reactivePowerSetpoint; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/threewindingstransformer/ThreeWindingsTransformerTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/threewindingstransformer/ThreeWindingsTransformerTabInfos.java index 5b9a6163..c6144c37 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/threewindingstransformer/ThreeWindingsTransformerTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/threewindingstransformer/ThreeWindingsTransformerTabInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.common.TapChangerData; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; @@ -45,40 +46,40 @@ public class ThreeWindingsTransformerTabInfos extends ElementInfosWithProperties private Boolean terminal3Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p3; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q3; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i3; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double permanentLimit1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double permanentLimit2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double permanentLimit3; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -108,13 +109,13 @@ public class ThreeWindingsTransformerTabInfos extends ElementInfosWithProperties @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean hasLoadTapChanging3Capabilities; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetV1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetV2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double targetV3; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -144,13 +145,13 @@ public class ThreeWindingsTransformerTabInfos extends ElementInfosWithProperties @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean isRegulatingPhase3; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double regulatingValue1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double regulatingValue2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double regulatingValue3; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/tieline/TieLineMapInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/tieline/TieLineMapInfos.java index 00e191a9..ee7aa93e 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/tieline/TieLineMapInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/tieline/TieLineMapInfos.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.common.CurrentLimitsData; @@ -33,16 +34,16 @@ public class TieLineMapInfos extends ElementInfos { private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/tieline/TieLineTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/tieline/TieLineTabInfos.java index f0fbde1d..5478f432 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/tieline/TieLineTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/tieline/TieLineTabInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; /** @@ -43,39 +44,39 @@ public class TieLineTabInfos extends ElementInfosWithProperties { private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double r; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double x; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double g1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double g2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b2; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerFormInfos.java index f50a4d42..fa765ca7 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerFormInfos.java @@ -9,16 +9,16 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; -import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.common.CurrentLimitsData; import org.gridsuite.network.map.dto.common.TapChangerData; +import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; import org.gridsuite.network.map.dto.definition.extension.TwoWindingsTransformerToBeEstimatedInfos; -import java.util.Optional; - import java.util.List; +import java.util.Optional; /** * @author AJELLAL Ali @@ -39,22 +39,22 @@ public class TwoWindingsTransformerFormInfos extends ElementInfosWithProperties private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_EMPTY) @@ -87,7 +87,7 @@ public class TwoWindingsTransformerFormInfos extends ElementInfosWithProperties private Double ratedU2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double ratedS; private ConnectablePositionInfos connectablePosition1; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerTabInfos.java index e0d678a6..32716a4b 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerTabInfos.java @@ -10,14 +10,11 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; -import org.gridsuite.network.map.dto.definition.extension.BranchObservabilityInfos; -import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.common.CurrentLimitsData; import org.gridsuite.network.map.dto.common.TapChangerData; -import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; -import org.gridsuite.network.map.dto.definition.extension.TapChangerDiscreteMeasurementsInfos; -import org.gridsuite.network.map.dto.definition.extension.TwoWindingsTransformerToBeEstimatedInfos; +import org.gridsuite.network.map.dto.definition.extension.*; import java.util.List; import java.util.Map; @@ -50,22 +47,22 @@ public class TwoWindingsTransformerTabInfos extends ElementInfosWithProperties { private Boolean terminal2Connected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_EMPTY) @@ -104,7 +101,7 @@ public class TwoWindingsTransformerTabInfos extends ElementInfosWithProperties { private Double ratedU2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double ratedS; private ConnectablePositionInfos connectablePosition1; diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerTooltipInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerTooltipInfos.java index 722c9f54..3fd48868 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerTooltipInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/twowindingstransformer/TwoWindingsTransformerTooltipInfos.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.common.CurrentLimitsData; @@ -21,10 +22,10 @@ public class TwoWindingsTransformerTooltipInfos extends ElementInfos { private String voltageLevelId2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i1; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double i2; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -33,13 +34,13 @@ public class TwoWindingsTransformerTooltipInfos extends ElementInfos { @JsonInclude(JsonInclude.Include.NON_NULL) private CurrentLimitsData currentLimits2; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double r; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double x; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double b; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelFormInfos.java index f42cd8f2..6d5f8a8c 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelFormInfos.java @@ -11,6 +11,7 @@ import com.powsybl.iidm.network.TopologyKind; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.IdentifiableShortCircuitInfos; @@ -30,12 +31,13 @@ public class VoltageLevelFormInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private String substationId; - private double nominalV; + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) + private Double nominalV; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double lowVoltageLimit; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double highVoltageLimit; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelMapInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelMapInfos.java index 3651f206..2a29f0bd 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelMapInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelMapInfos.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfos; /** @@ -21,6 +22,7 @@ public class VoltageLevelMapInfos extends ElementInfos { @JsonInclude(JsonInclude.Include.NON_NULL) private String substationId; - private double nominalV; + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) + private Double nominalV; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelTabInfos.java index c5c0d29e..543765bd 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/VoltageLevelTabInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.IdentifiableShortCircuitInfos; @@ -25,15 +26,16 @@ public class VoltageLevelTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private String substationId; - private double nominalV; + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) + private Double nominalV; @JsonInclude(JsonInclude.Include.NON_NULL) private Country country; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double lowVoltageLimit; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double highVoltageLimit; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/vscconverterstation/VscConverterStationFormInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/vscconverterstation/VscConverterStationFormInfos.java index b30b1f53..914a7dd0 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/vscconverterstation/VscConverterStationFormInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/vscconverterstation/VscConverterStationFormInfos.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; @@ -24,13 +25,13 @@ @SuperBuilder @Getter public class VscConverterStationFormInfos extends ElementInfos { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float lossFactor; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double voltageSetpoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double reactivePowerSetpoint; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -39,10 +40,10 @@ public class VscConverterStationFormInfos extends ElementInfos { private Boolean terminalConnected; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/vscconverterstation/VscConverterStationTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/vscconverterstation/VscConverterStationTabInfos.java index ec307075..c623eb97 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/vscconverterstation/VscConverterStationTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/vscconverterstation/VscConverterStationTabInfos.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.Country; import lombok.Getter; import lombok.experimental.SuperBuilder; +import org.gridsuite.network.map.config.nan.NullAndNaNFilter; import org.gridsuite.network.map.dto.ElementInfosWithProperties; import org.gridsuite.network.map.dto.definition.extension.InjectionObservabilityInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; @@ -23,13 +24,13 @@ @SuperBuilder @Getter public class VscConverterStationTabInfos extends ElementInfosWithProperties { - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Float lossFactor; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double voltageSetpoint; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double reactivePowerSetpoint; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -45,10 +46,10 @@ public class VscConverterStationTabInfos extends ElementInfosWithProperties { private String hvdcLineId; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double p; - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullAndNaNFilter.class) private Double q; @JsonInclude(JsonInclude.Include.NON_ABSENT) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/BatteryInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/BatteryInfosMapper.java index 25d32ed8..ce8e3a85 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/BatteryInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/BatteryInfosMapper.java @@ -11,10 +11,10 @@ import com.powsybl.network.store.iidm.impl.MinMaxReactiveLimitsImpl; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.InfoTypeParameters; -import org.gridsuite.network.map.dto.definition.battery.BatteryFormInfos; -import org.gridsuite.network.map.dto.definition.battery.BatteryTabInfos; import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; import org.gridsuite.network.map.dto.common.ReactiveCapabilityCurveMapData; +import org.gridsuite.network.map.dto.definition.battery.BatteryFormInfos; +import org.gridsuite.network.map.dto.definition.battery.BatteryTabInfos; import java.util.Collection; import java.util.List; @@ -62,12 +62,12 @@ private static BatteryFormInfos toFormInfos(Identifiable identifiable) { .voltageLevelId(terminal.getVoltageLevel().getId()) .busOrBusbarSectionId(getBusOrBusbarSection(terminal)) .targetP(battery.getTargetP()) - .targetQ(nullIfNan(battery.getTargetQ())) + .targetQ(battery.getTargetQ()) .minP(battery.getMinP()) .maxP(battery.getMaxP()) - .p(nullIfNan(terminal.getP())) + .p(terminal.getP()) .terminalConnected(terminal.isConnected()) - .q(nullIfNan(terminal.getQ())) + .q(terminal.getQ()) .properties(getProperties(battery)) .connectablePosition(toMapConnectablePosition(battery, 0)); @@ -99,12 +99,12 @@ private static BatteryTabInfos toTabInfos(Identifiable identifiable) { .nominalVoltage(terminal.getVoltageLevel().getNominalV()) .country(mapCountry(terminal.getVoltageLevel().getSubstation().orElse(null))) .targetP(battery.getTargetP()) - .targetQ(nullIfNan(battery.getTargetQ())) + .targetQ(battery.getTargetQ()) .minP(battery.getMinP()) .maxP(battery.getMaxP()) - .p(nullIfNan(terminal.getP())) + .p(terminal.getP()) .properties(getProperties(battery)) - .q(nullIfNan(terminal.getQ())); + .q(terminal.getQ()); builder.connectablePosition(toMapConnectablePosition(battery, 0)) .activePowerControl(toActivePowerControl(battery)); diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/DanglingLineInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/DanglingLineInfosMapper.java index 459c3eff..ff0faf16 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/DanglingLineInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/DanglingLineInfosMapper.java @@ -48,9 +48,9 @@ private static DanglingLineTabInfos toTabInfos(Identifiable identifiable) { .p0(danglingLine.getP0()) .properties(getProperties(danglingLine)) .q0(danglingLine.getQ0()) - .p(nullIfNan(terminal.getP())) - .q(nullIfNan(terminal.getQ())) - .i(nullIfNan(terminal.getI())); + .p(terminal.getP()) + .q(terminal.getQ()) + .i(terminal.getI()); builder.measurementP(toMeasurement(danglingLine, Measurement.Type.ACTIVE_POWER, 0)) .measurementQ(toMeasurement(danglingLine, Measurement.Type.REACTIVE_POWER, 0)); diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/GeneratorInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/GeneratorInfosMapper.java index 99ca327a..4bc80cf0 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/GeneratorInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/GeneratorInfosMapper.java @@ -11,10 +11,10 @@ import com.powsybl.network.store.iidm.impl.MinMaxReactiveLimitsImpl; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.InfoTypeParameters; -import org.gridsuite.network.map.dto.definition.generator.GeneratorFormInfos; -import org.gridsuite.network.map.dto.definition.generator.GeneratorTabInfos; import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; import org.gridsuite.network.map.dto.common.ReactiveCapabilityCurveMapData; +import org.gridsuite.network.map.dto.definition.generator.GeneratorFormInfos; +import org.gridsuite.network.map.dto.definition.generator.GeneratorTabInfos; import java.util.Collection; import java.util.List; @@ -65,16 +65,16 @@ private static GeneratorTabInfos toTabInfos(Identifiable identifiable) { .nominalVoltage(terminal.getVoltageLevel().getNominalV()) .country(mapCountry(terminal.getVoltageLevel().getSubstation().orElse(null))) .targetP(generator.getTargetP()) - .targetQ(nullIfNan(generator.getTargetQ())) - .targetV(nullIfNan(generator.getTargetV())) + .targetQ(generator.getTargetQ()) + .targetV(generator.getTargetV()) .minP(generator.getMinP()) .maxP(generator.getMaxP()) - .ratedS(nullIfNan(generator.getRatedS())) + .ratedS(generator.getRatedS()) .energySource(generator.getEnergySource()) .voltageRegulatorOn(generator.isVoltageRegulatorOn()) - .p(nullIfNan(terminal.getP())) + .p(terminal.getP()) .properties(getProperties(generator)) - .q(nullIfNan(terminal.getQ())); + .q(terminal.getQ()); builder.activePowerControl(toActivePowerControl(generator)) .coordinatedReactiveControl(toCoordinatedReactiveControl(generator)) @@ -136,15 +136,15 @@ private static GeneratorFormInfos toFormInfos(Identifiable identifiable) { .terminalConnected(terminal.isConnected()) .voltageLevelId(terminal.getVoltageLevel().getId()) .targetP(generator.getTargetP()) - .targetQ(nullIfNan(generator.getTargetQ())) - .targetV(nullIfNan(generator.getTargetV())) + .targetQ(generator.getTargetQ()) + .targetV(generator.getTargetV()) .minP(generator.getMinP()) .maxP(generator.getMaxP()) - .ratedS(nullIfNan(generator.getRatedS())) + .ratedS(generator.getRatedS()) .energySource(generator.getEnergySource()) .voltageRegulatorOn(generator.isVoltageRegulatorOn()) - .p(nullIfNan(terminal.getP())) - .q(nullIfNan(terminal.getQ())) + .p(terminal.getP()) + .q(terminal.getQ()) .properties(getProperties(generator)); builder.busOrBusbarSectionId(getBusOrBusbarSection(terminal)) .activePowerControl(toActivePowerControl(generator)); diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/HvdcInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/HvdcInfosMapper.java index 6d3ea030..a6b5bc91 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/HvdcInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/HvdcInfosMapper.java @@ -52,8 +52,8 @@ protected static HvdcMapInfos toMapInfos(Identifiable identifiable) { .voltageLevelId2(hvdcLine.getConverterStation2().getTerminal().getVoltageLevel().getId()) .terminal1Connected(hvdcLine.getConverterStation1().getTerminal().isConnected()) .terminal2Connected(hvdcLine.getConverterStation2().getTerminal().isConnected()) - .p1(nullIfNan(hvdcLine.getConverterStation1().getTerminal().getP())) - .p2(nullIfNan(hvdcLine.getConverterStation2().getTerminal().getP())) + .p1(hvdcLine.getConverterStation1().getTerminal().getP()) + .p2(hvdcLine.getConverterStation2().getTerminal().getP()) .hvdcType(hvdcLine.getConverterStation1().getHvdcType()) .operatingStatus(toOperatingStatus(hvdcLine)) .build(); @@ -85,8 +85,8 @@ protected static HvdcTabInfos toHvdcTabInfos(Identifiable identifiable) { .voltageLevelId2(terminal2.getVoltageLevel().getId()) .country1(mapCountry(terminal1.getVoltageLevel().getSubstation().orElse(null))) .country2(mapCountry(terminal2.getVoltageLevel().getSubstation().orElse(null))) - .i1(nullIfNan(terminal1.getI())) - .i2(nullIfNan(terminal2.getI())); + .i1(terminal1.getI()) + .i2(terminal2.getI()); builder .convertersMode(hvdcLine.getConvertersMode()) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/LineInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/LineInfosMapper.java index 7a80abe8..240a89f9 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/LineInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/LineInfosMapper.java @@ -6,7 +6,9 @@ */ package org.gridsuite.network.map.dto.mapper; -import com.powsybl.iidm.network.*; +import com.powsybl.iidm.network.Identifiable; +import com.powsybl.iidm.network.Line; +import com.powsybl.iidm.network.Terminal; import com.powsybl.iidm.network.extensions.Measurement; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.InfoTypeParameters; @@ -53,12 +55,12 @@ private static LineFormInfos toFormInfos(Identifiable identifiable) { .voltageLevelName1(terminal1.getVoltageLevel().getOptionalName().orElse(null)) .voltageLevelId2(terminal2.getVoltageLevel().getId()) .voltageLevelName2(terminal2.getVoltageLevel().getOptionalName().orElse(null)) - .p1(nullIfNan(terminal1.getP())) - .q1(nullIfNan(terminal1.getQ())) - .p2(nullIfNan(terminal2.getP())) - .q2(nullIfNan(terminal2.getQ())) - .i1(nullIfNan(terminal1.getI())) - .i2(nullIfNan(terminal2.getI())) + .p1(terminal1.getP()) + .q1(terminal1.getQ()) + .p2(terminal2.getP()) + .q2(terminal2.getQ()) + .i1(terminal1.getI()) + .i2(terminal2.getI()) .r(line.getR()) .x(line.getX()) .g1(line.getG1()) @@ -120,10 +122,10 @@ private static LineMapInfos toMapInfos(Identifiable identifiable, Double dcPo .voltageLevelName1(terminal1.getVoltageLevel().getOptionalName().orElse(null)) .voltageLevelId2(terminal2.getVoltageLevel().getId()) .voltageLevelName2(terminal2.getVoltageLevel().getOptionalName().orElse(null)) - .p1(nullIfNan(terminal1.getP())) - .p2(nullIfNan(terminal2.getP())) - .i1(nullIfNan(ElementUtils.computeIntensity(terminal1, dcPowerFactor))) - .i2(nullIfNan(ElementUtils.computeIntensity(terminal2, dcPowerFactor))); + .p1(terminal1.getP()) + .p2(terminal2.getP()) + .i1(ElementUtils.computeIntensity(terminal1, dcPowerFactor)) + .i2(ElementUtils.computeIntensity(terminal2, dcPowerFactor)); line.getCurrentLimits1().ifPresent(limits1 -> builder.currentLimits1(toMapDataCurrentLimits(limits1))); line.getCurrentLimits2().ifPresent(limits2 -> builder.currentLimits2(toMapDataCurrentLimits(limits2))); @@ -149,12 +151,12 @@ private static LineTabInfos toTabInfos(Identifiable identifiable, Double dcPo .nominalVoltage2(terminal2.getVoltageLevel().getNominalV()) .country1(mapCountry(terminal1.getVoltageLevel().getSubstation().orElse(null))) .country2(mapCountry(terminal2.getVoltageLevel().getSubstation().orElse(null))) - .p1(nullIfNan(terminal1.getP())) - .q1(nullIfNan(terminal1.getQ())) - .i1(nullIfNan(ElementUtils.computeIntensity(terminal1, dcPowerFactor))) - .p2(nullIfNan(terminal2.getP())) - .q2(nullIfNan(terminal2.getQ())) - .i2(nullIfNan(ElementUtils.computeIntensity(terminal2, dcPowerFactor))) + .p1(terminal1.getP()) + .q1(terminal1.getQ()) + .i1(ElementUtils.computeIntensity(terminal1, dcPowerFactor)) + .p2(terminal2.getP()) + .q2(terminal2.getQ()) + .i2(ElementUtils.computeIntensity(terminal2, dcPowerFactor)) .r(line.getR()) .x(line.getX()) .g1(line.getG1()) @@ -195,8 +197,8 @@ private static LineTooltipInfos toTooltipInfos(Identifiable identifiable, Dou .terminal2Connected(terminal2.isConnected()) .voltageLevelId1(terminal1.getVoltageLevel().getId()) .voltageLevelId2(terminal2.getVoltageLevel().getId()) - .i1(nullIfNan(ElementUtils.computeIntensity(terminal1, dcPowerFactor))) - .i2(nullIfNan(ElementUtils.computeIntensity(terminal2, dcPowerFactor))) + .i1(ElementUtils.computeIntensity(terminal1, dcPowerFactor)) + .i2(ElementUtils.computeIntensity(terminal2, dcPowerFactor)) .r(line.getR()) .x(line.getX()) .b1(line.getB1()) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/StaticVarCompensatorInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/StaticVarCompensatorInfosMapper.java index 88f9112f..504ffdd9 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/StaticVarCompensatorInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/StaticVarCompensatorInfosMapper.java @@ -45,12 +45,12 @@ private static StaticVarCompensatorFormInfos toFormInfos(Identifiable identif .id(staticVarCompensator.getId()) .terminalConnected(terminal.isConnected()) .voltageLevelId(terminal.getVoltageLevel().getId()) - .nominalV(nullIfNan(terminal.getVoltageLevel().getNominalV())) + .nominalV(terminal.getVoltageLevel().getNominalV()) .regulationMode(staticVarCompensator.getRegulationMode()) - .maxSusceptance(nullIfNan(staticVarCompensator.getBmax())) - .minSusceptance(nullIfNan(staticVarCompensator.getBmin())) - .voltageSetpoint(nullIfNan(staticVarCompensator.getVoltageSetpoint())) - .reactivePowerSetpoint(nullIfNan(staticVarCompensator.getReactivePowerSetpoint())) + .maxSusceptance(staticVarCompensator.getBmax()) + .minSusceptance(staticVarCompensator.getBmin()) + .voltageSetpoint(staticVarCompensator.getVoltageSetpoint()) + .reactivePowerSetpoint(staticVarCompensator.getReactivePowerSetpoint()) .busOrBusbarSectionId(getBusOrBusbarSection(terminal)) .properties(getProperties(staticVarCompensator)) .connectablePosition(toMapConnectablePosition(staticVarCompensator, 0)) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/TieLineInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/TieLineInfosMapper.java index 9a59084e..a9663c5e 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/TieLineInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/TieLineInfosMapper.java @@ -50,10 +50,10 @@ private static TieLineMapInfos toMapInfos(Identifiable identifiable, Double d .voltageLevelName1(terminal1.getVoltageLevel().getOptionalName().orElse(null)) .voltageLevelId2(terminal2.getVoltageLevel().getId()) .voltageLevelName2(terminal2.getVoltageLevel().getOptionalName().orElse(null)) - .p1(nullIfNan(terminal1.getP())) - .p2(nullIfNan(terminal2.getP())) - .i1(nullIfNan(ElementUtils.computeIntensity(terminal1, dcPowerFactor))) - .i2(nullIfNan(ElementUtils.computeIntensity(terminal2, dcPowerFactor))) + .p1(terminal1.getP()) + .p2(terminal2.getP()) + .i1(ElementUtils.computeIntensity(terminal1, dcPowerFactor)) + .i2(ElementUtils.computeIntensity(terminal2, dcPowerFactor)) .operatingStatus(toOperatingStatus(tieLine)); tieLine.getCurrentLimits1().ifPresent(limits1 -> builder.currentLimits1(toMapDataCurrentLimits(limits1))); @@ -79,12 +79,12 @@ private static TieLineTabInfos toTabInfos(Identifiable identifiable, Double d .nominalVoltage2(terminal2.getVoltageLevel().getNominalV()) .country1(mapCountry(terminal1.getVoltageLevel().getSubstation().orElse(null))) .country2(mapCountry(terminal2.getVoltageLevel().getSubstation().orElse(null))) - .p1(nullIfNan(terminal1.getP())) - .q1(nullIfNan(terminal1.getQ())) - .p2(nullIfNan(terminal2.getP())) - .q2(nullIfNan(terminal2.getQ())) - .i1(nullIfNan(ElementUtils.computeIntensity(terminal1, dcPowerFactor))) - .i2(nullIfNan(ElementUtils.computeIntensity(terminal2, dcPowerFactor))) + .p1(terminal1.getP()) + .q1(terminal1.getQ()) + .p2(terminal2.getP()) + .q2(terminal2.getQ()) + .i1(ElementUtils.computeIntensity(terminal1, dcPowerFactor)) + .i2(ElementUtils.computeIntensity(terminal2, dcPowerFactor)) .r(tieLine.getR()) .x(tieLine.getX()) .g1(tieLine.getG1()) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/TwoWindingsTransformerInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/TwoWindingsTransformerInfosMapper.java index 66f97558..d9d0490b 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/TwoWindingsTransformerInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/TwoWindingsTransformerInfosMapper.java @@ -6,7 +6,10 @@ */ package org.gridsuite.network.map.dto.mapper; -import com.powsybl.iidm.network.*; +import com.powsybl.iidm.network.Identifiable; +import com.powsybl.iidm.network.Substation; +import com.powsybl.iidm.network.Terminal; +import com.powsybl.iidm.network.TwoWindingsTransformer; import com.powsybl.iidm.network.extensions.DiscreteMeasurement; import com.powsybl.iidm.network.extensions.Measurement; import com.powsybl.iidm.network.extensions.TwoWindingsTransformerToBeEstimated; @@ -14,7 +17,10 @@ import org.gridsuite.network.map.dto.InfoTypeParameters; import org.gridsuite.network.map.dto.common.CurrentLimitsData; import org.gridsuite.network.map.dto.definition.extension.TwoWindingsTransformerToBeEstimatedInfos; -import org.gridsuite.network.map.dto.definition.twowindingstransformer.*; +import org.gridsuite.network.map.dto.definition.twowindingstransformer.TwoWindingsTransformerFormInfos; +import org.gridsuite.network.map.dto.definition.twowindingstransformer.TwoWindingsTransformerOperatingStatusInfos; +import org.gridsuite.network.map.dto.definition.twowindingstransformer.TwoWindingsTransformerTabInfos; +import org.gridsuite.network.map.dto.definition.twowindingstransformer.TwoWindingsTransformerTooltipInfos; import org.gridsuite.network.map.dto.utils.ElementUtils; import java.util.List; @@ -72,13 +78,13 @@ private static TwoWindingsTransformerFormInfos toFormInfos(Identifiable ident builder.busOrBusbarSectionId1(getBusOrBusbarSection(terminal1)) .busOrBusbarSectionId2(getBusOrBusbarSection(terminal2)); - builder.ratedS(nullIfNan(twoWT.getRatedS())); - builder.p1(nullIfNan(terminal1.getP())); - builder.q1(nullIfNan(terminal1.getQ())); - builder.p2(nullIfNan(terminal2.getP())); - builder.q2(nullIfNan(terminal2.getQ())); - builder.i1(nullIfNan(terminal1.getI())); - builder.i2(nullIfNan(terminal2.getI())); + builder.ratedS(twoWT.getRatedS()); + builder.p1(terminal1.getP()); + builder.q1(terminal1.getQ()); + builder.p2(terminal2.getP()); + builder.q2(terminal2.getQ()); + builder.i1(terminal1.getI()); + builder.i2(terminal2.getI()); buildCurrentLimits(twoWT.getOperationalLimitsGroups1(), builder::currentLimits1); buildCurrentLimits(twoWT.getOperationalLimitsGroups2(), builder::currentLimits2); @@ -124,13 +130,13 @@ private static TwoWindingsTransformerTabInfos toTabInfos(Identifiable identif .g(twoWT.getG()) .ratedU1(twoWT.getRatedU1()) .ratedU2(twoWT.getRatedU2()); - builder.ratedS(nullIfNan(twoWT.getRatedS())); - builder.p1(nullIfNan(terminal1.getP())); - builder.q1(nullIfNan(terminal1.getQ())); - builder.i1(nullIfNan(ElementUtils.computeIntensity(terminal1, dcPowerFactor))); - builder.p2(nullIfNan(terminal2.getP())); - builder.q2(nullIfNan(terminal2.getQ())); - builder.i2(nullIfNan(ElementUtils.computeIntensity(terminal2, dcPowerFactor))); + builder.ratedS(twoWT.getRatedS()); + builder.p1(terminal1.getP()); + builder.q1(terminal1.getQ()); + builder.i1(ElementUtils.computeIntensity(terminal1, dcPowerFactor)); + builder.p2(terminal2.getP()); + builder.q2(terminal2.getQ()); + builder.i2(ElementUtils.computeIntensity(terminal2, dcPowerFactor)); builder.operatingStatus(toOperatingStatus(twoWT)); @@ -196,8 +202,8 @@ private static TwoWindingsTransformerTooltipInfos toTooltipInfos(Identifiable .name(twoWindingsTransformer.getOptionalName().orElse(null)) .voltageLevelId1(terminal1.getVoltageLevel().getId()) .voltageLevelId2(terminal2.getVoltageLevel().getId()) - .i1(nullIfNan(ElementUtils.computeIntensity(terminal1, dcPowerFactor))) - .i2(nullIfNan(ElementUtils.computeIntensity(terminal2, dcPowerFactor))) + .i1(ElementUtils.computeIntensity(terminal1, dcPowerFactor)) + .i2(ElementUtils.computeIntensity(terminal2, dcPowerFactor)) .r(twoWindingsTransformer.getR()) .x(twoWindingsTransformer.getX()) .b(twoWindingsTransformer.getB()); diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/VoltageLevelInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/VoltageLevelInfosMapper.java index f161dbe8..e5c8c0ac 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/VoltageLevelInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/VoltageLevelInfosMapper.java @@ -119,9 +119,9 @@ protected static VoltageLevelTabInfos toTabInfos(Identifiable identifiable) { .substationId(voltageLevel.getSubstation().map(Substation::getId).orElse(null)) .nominalV(voltageLevel.getNominalV()) .country(mapCountry(voltageLevel.getSubstation().orElse(null))) - .lowVoltageLimit(nullIfNan(voltageLevel.getLowVoltageLimit())) + .lowVoltageLimit(voltageLevel.getLowVoltageLimit()) .properties(getProperties(voltageLevel)) - .highVoltageLimit(nullIfNan(voltageLevel.getHighVoltageLimit())); + .highVoltageLimit(voltageLevel.getHighVoltageLimit()); builder.identifiableShortCircuit(toIdentifiableShortCircuit(voltageLevel)); return builder.build(); diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/VscConverterStationInfosMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/VscConverterStationInfosMapper.java index 0e1690ba..5036e7f6 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/VscConverterStationInfosMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/VscConverterStationInfosMapper.java @@ -11,9 +11,9 @@ import com.powsybl.network.store.iidm.impl.MinMaxReactiveLimitsImpl; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.InfoTypeParameters; +import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; import org.gridsuite.network.map.dto.definition.vscconverterstation.VscConverterStationFormInfos; import org.gridsuite.network.map.dto.definition.vscconverterstation.VscConverterStationTabInfos; -import org.gridsuite.network.map.dto.common.MinMaxReactiveLimitsMapData; import static org.gridsuite.network.map.dto.utils.ElementUtils.*; @@ -87,11 +87,11 @@ public static VscConverterStationFormInfos toFormInfos(Identifiable identifia .terminalConnected(terminal.isConnected()) .lossFactor(vscConverterStation.getLossFactor()) .voltageRegulatorOn(vscConverterStation.isVoltageRegulatorOn()) - .voltageSetpoint(nullIfNan(vscConverterStation.getVoltageSetpoint())) - .reactivePowerSetpoint(nullIfNan(vscConverterStation.getReactivePowerSetpoint())) + .voltageSetpoint(vscConverterStation.getVoltageSetpoint()) + .reactivePowerSetpoint(vscConverterStation.getReactivePowerSetpoint()) .busOrBusbarSectionId(getBusOrBusbarSection(terminal)) - .q(nullIfNan(terminal.getQ())) - .p(nullIfNan(terminal.getP())) + .q(terminal.getQ()) + .p(terminal.getP()) .connectablePositionInfos(toMapConnectablePosition(vscConverterStation, 0)); ReactiveLimits reactiveLimits = vscConverterStation.getReactiveLimits(); diff --git a/src/main/java/org/gridsuite/network/map/dto/utils/ElementUtils.java b/src/main/java/org/gridsuite/network/map/dto/utils/ElementUtils.java index cc0431a5..141dba94 100644 --- a/src/main/java/org/gridsuite/network/map/dto/utils/ElementUtils.java +++ b/src/main/java/org/gridsuite/network/map/dto/utils/ElementUtils.java @@ -15,11 +15,7 @@ import org.gridsuite.network.map.dto.definition.threewindingstransformer.ThreeWindingsTransformerTabInfos; import org.springframework.util.CollectionUtils; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; @@ -31,10 +27,6 @@ public final class ElementUtils { private ElementUtils() { } - public static Double nullIfNan(double d) { - return Double.isNaN(d) ? null : d; - } - private static ConnectablePosition.Feeder getFeederInfos(Identifiable identifiable, int index) { var connectablePosition = identifiable.getExtension(ConnectablePosition.class); if (connectablePosition == null) { @@ -96,11 +88,11 @@ public static Optional toStandbyAutomaton(StaticVarCompen return standbyAutomatonInfos == null ? Optional.empty() : Optional.of(StandbyAutomatonInfos.builder() .standby(standbyAutomatonInfos.isStandby()) - .b0(nullIfNan(standbyAutomatonInfos.getB0())) - .lowVoltageSetpoint(nullIfNan(standbyAutomatonInfos.getLowVoltageSetpoint())) - .highVoltageSetpoint(nullIfNan(standbyAutomatonInfos.getHighVoltageSetpoint())) - .highVoltageThreshold(nullIfNan(standbyAutomatonInfos.getHighVoltageThreshold())) - .lowVoltageThreshold(nullIfNan(standbyAutomatonInfos.getLowVoltageThreshold())).build()); + .b0(standbyAutomatonInfos.getB0()) + .lowVoltageSetpoint(standbyAutomatonInfos.getLowVoltageSetpoint()) + .highVoltageSetpoint(standbyAutomatonInfos.getHighVoltageSetpoint()) + .highVoltageThreshold(standbyAutomatonInfos.getHighVoltageThreshold()) + .lowVoltageThreshold(standbyAutomatonInfos.getLowVoltageThreshold()).build()); } public static Optional toActivePowerControl(Identifiable identifiable) { @@ -140,8 +132,6 @@ public static CoordinatedReactiveControlInfos toCoordinatedReactiveControl(Gener CoordinatedReactiveControl coordinatedReactiveControl = generator.getExtension(CoordinatedReactiveControl.class); if (coordinatedReactiveControl != null) { builder.qPercent(coordinatedReactiveControl.getQPercent()); - } else { - builder.qPercent(Double.NaN); } return builder.build(); } @@ -150,10 +140,10 @@ public static Optional toGeneratorStartup(Generator gener GeneratorStartup generatorStartup = generator.getExtension(GeneratorStartup.class); return generatorStartup == null ? Optional.empty() : Optional.of(GeneratorStartupInfos.builder() - .plannedActivePowerSetPoint(nullIfNan(generatorStartup.getPlannedActivePowerSetpoint())) - .marginalCost(nullIfNan(generatorStartup.getMarginalCost())) - .plannedOutageRate(nullIfNan(generatorStartup.getPlannedOutageRate())) - .forcedOutageRate(nullIfNan(generatorStartup.getForcedOutageRate())).build()); + .plannedActivePowerSetPoint(generatorStartup.getPlannedActivePowerSetpoint()) + .marginalCost(generatorStartup.getMarginalCost()) + .plannedOutageRate(generatorStartup.getPlannedOutageRate()) + .forcedOutageRate(generatorStartup.getForcedOutageRate()).build()); } public static Optional toIdentifiableShortCircuit(VoltageLevel voltageLevel) { @@ -266,8 +256,8 @@ public static TapChangerData toMapData(PhaseTapChanger tapChanger) { .regulatingTerminalVlId(tapChanger.getRegulationTerminal() != null ? tapChanger.getRegulationTerminal().getVoltageLevel().getId() : null) .steps(toMapDataPhaseStep(tapChanger.getAllSteps())); - builder.targetDeadband(nullIfNan(tapChanger.getTargetDeadband())); - builder.regulationValue(nullIfNan(tapChanger.getRegulationValue())); + builder.targetDeadband(tapChanger.getTargetDeadband()); + builder.regulationValue(tapChanger.getRegulationValue()); return builder.build(); } @@ -287,8 +277,8 @@ public static TapChangerData toMapData(RatioTapChanger tapChanger) { .regulatingTerminalVlId(tapChanger.getRegulationTerminal() != null ? tapChanger.getRegulationTerminal().getVoltageLevel().getId() : null) .steps(toMapDataRatioStep(tapChanger.getAllSteps())); - builder.targetV(nullIfNan(tapChanger.getTargetV())); - builder.targetDeadband(nullIfNan(tapChanger.getTargetDeadband())); + builder.targetV(tapChanger.getTargetV()); + builder.targetDeadband(tapChanger.getTargetDeadband()); return builder.build(); } diff --git a/src/test/java/org/gridsuite/network/map/ListHandlingControllerTest.java b/src/test/java/org/gridsuite/network/map/ListHandlingControllerTest.java index cd890dda..567c790f 100644 --- a/src/test/java/org/gridsuite/network/map/ListHandlingControllerTest.java +++ b/src/test/java/org/gridsuite/network/map/ListHandlingControllerTest.java @@ -14,7 +14,8 @@ import org.junit.jupiter.params.provider.MethodSource; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; @@ -32,7 +33,8 @@ * Tests to assure the {@link NetworkMapController} handle empty {@link List} and {@code null} values the same in endpoints parameters. */ @SuppressWarnings("OptionalUsedAsFieldOrParameterType") -@WebMvcTest(controllers = NetworkMapController.class) +@AutoConfigureMockMvc +@SpringBootTest class ListHandlingControllerTest { private static final UUID NETWORK_ID = UUID.randomUUID(); diff --git a/src/test/resources/all-data-in-variant.json b/src/test/resources/all-data-in-variant.json index 468a9f52..81ed0ee7 100644 --- a/src/test/resources/all-data-in-variant.json +++ b/src/test/resources/all-data-in-variant.json @@ -1910,8 +1910,8 @@ "buses": [ { "id": "VLGEN_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN", @@ -1920,8 +1920,8 @@ }, { "id": "VLHV1_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLHV1", @@ -1930,8 +1930,8 @@ }, { "id": "VLHV2_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLHV2", @@ -1939,8 +1939,8 @@ }, { "id": "VLLOAD_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLLOAD", @@ -1948,8 +1948,8 @@ }, { "id": "VLNEW2_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLNEW2", @@ -1958,8 +1958,8 @@ }, { "id": "VLGEN3_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN3", @@ -1968,8 +1968,8 @@ }, { "id": "VLGEN6_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN6", diff --git a/src/test/resources/all-data.json b/src/test/resources/all-data.json index 8f5c22ee..b4e34f57 100644 --- a/src/test/resources/all-data.json +++ b/src/test/resources/all-data.json @@ -1891,8 +1891,8 @@ "buses": [ { "id": "VLGEN_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN", @@ -1901,8 +1901,8 @@ }, { "id": "VLHV1_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLHV1", @@ -1911,8 +1911,8 @@ }, { "id": "VLHV2_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLHV2", @@ -1920,8 +1920,8 @@ }, { "id": "VLLOAD_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLLOAD", @@ -1929,8 +1929,8 @@ }, { "id": "VLNEW2_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLNEW2", @@ -1939,8 +1939,8 @@ }, { "id": "VLGEN3_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN3", @@ -1949,8 +1949,8 @@ }, { "id": "VLGEN6_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN6", @@ -1959,8 +1959,8 @@ }, { "id": "VLGEN4_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 1, "connectedComponentNum": 1, "voltageLevelId": "VLGEN4", diff --git a/src/test/resources/buses-tab-data.json b/src/test/resources/buses-tab-data.json index 0c8a799d..e0ee5076 100644 --- a/src/test/resources/buses-tab-data.json +++ b/src/test/resources/buses-tab-data.json @@ -1,8 +1,8 @@ [ { "id": "n9828181c-7977-4592-ba19-008976e4254e_voltageLevel1_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "n9828181c-7977-4592-ba19-008976e4254e_voltageLevel1", diff --git a/src/test/resources/partial-all-data-in-variant.json b/src/test/resources/partial-all-data-in-variant.json index da27ec7a..d350fe18 100644 --- a/src/test/resources/partial-all-data-in-variant.json +++ b/src/test/resources/partial-all-data-in-variant.json @@ -260,8 +260,8 @@ "buses": [ { "id": "VLGEN3_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN3", diff --git a/src/test/resources/partial-all-data.json b/src/test/resources/partial-all-data.json index 9af87129..b73e8364 100644 --- a/src/test/resources/partial-all-data.json +++ b/src/test/resources/partial-all-data.json @@ -241,8 +241,8 @@ "buses": [ { "id": "VLGEN3_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN3", diff --git a/src/test/resources/partial-all-map-data-no-redundant-lines.json b/src/test/resources/partial-all-map-data-no-redundant-lines.json index b3298561..3170f771 100644 --- a/src/test/resources/partial-all-map-data-no-redundant-lines.json +++ b/src/test/resources/partial-all-map-data-no-redundant-lines.json @@ -278,8 +278,8 @@ "buses": [ { "id": "VLGEN3_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN3", @@ -288,8 +288,8 @@ }, { "id": "VLGEN6_0", - "v": "NaN", - "angle": "NaN", + "v": null, + "angle": null, "synchronousComponentNum": 0, "connectedComponentNum": 0, "voltageLevelId": "VLGEN6",