Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean some deprecated methods #2611

Merged
merged 8 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,6 @@ public PowerFlow powerFlowAtNode(String node) {
return nodesPowerFlow.get(node);
}

/**
* @deprecated Not used anymore. To set an equipment at boundary node, use
* {@link CgmesBoundary#addAcLineSegmentAtNode(PropertyBag, String)} or
* {@link CgmesBoundary#addSwitchAtNode(PropertyBag, String)} or
* {@link CgmesBoundary#addTransformerAtNode(PropertyBags, String)} or
* {@link CgmesBoundary#addEquivalentBranchAtNode(PropertyBag, String)} instead.
*/
@Deprecated
public void addEquipmentAtNode(PropertyBag line, String node) {
throw new ConversionException("Deprecated. Not used anymore");
}

public void addAcLineSegmentAtNode(PropertyBag line, String node) {
List<BoundaryEquipment> equipment;
equipment = nodesEquipment.computeIfAbsent(node, ls -> new ArrayList<>(2));
Expand Down Expand Up @@ -148,15 +136,6 @@ public double angleAtBoundary(String node) {
return nodesVoltage.containsKey(node) ? nodesVoltage.get(node).angle : Double.NaN;
}

/**
* @deprecated Not used anymore. To get the equipment at boundary node, use
* {@link CgmesBoundary#boundaryEquipmentAtNode(String)} instead.
*/
@Deprecated
public List<PropertyBag> equipmentAtNode(String node) {
throw new ConversionException("Deprecated. Not used anymore");
}

public List<BoundaryEquipment> boundaryEquipmentAtNode(String node) {
return nodesEquipment.getOrDefault(node, Collections.emptyList());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2023, 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/.
* SPDX-License-Identifier: MPL-2.0
*/
package com.powsybl.cgmes.conversion.test;

import com.powsybl.cgmes.model.CgmesModel;
import com.powsybl.cgmes.model.InMemoryCgmesModel;
import org.junit.jupiter.api.Test;

import java.util.Collections;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Luma Zamarreño <zamarrenolm at aia.es>
*/
class FakeTapChangerConversionTest {
@Test
void fakeTapChangersEmpty() {
CgmesModel cgmes = new InMemoryCgmesModel();
assertEquals(Collections.emptyList(), cgmes.ratioTapChangerListForPowerTransformer("anyTransformer"));
assertEquals(Collections.emptyList(), cgmes.phaseTapChangerListForPowerTransformer("anyTransformer"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
public interface CgmesModel {

// FIXME generic cgmes models may not have an underlying triplestore
// Although generic cgmes models may not have an underlying triplestore
TripleStore tripleStore();

Properties getProperties();
Expand Down Expand Up @@ -184,40 +184,9 @@ default void write(DataSource ds, CgmesSubset subset) {

// Helper mappings

/**
* @deprecated Not used anymore. To get the CGMES Terminal ID of an equipment, use alias i.e.
* {@code equipement.getAlias("CGMES.Terminal1")}
*/
@Deprecated
default String terminalForEquipment(String conductingEquipmentId, int sequenceNumber) {
return null;
}

/**
* @deprecated Use {@link #ratioTapChangerListForPowerTransformer(String)} instead.
*/
@Deprecated
default String ratioTapChangerForPowerTransformer(String powerTransformerId) {
return ratioTapChangerListForPowerTransformer(powerTransformerId).stream().filter(Objects::nonNull).findFirst().orElse(null);
}

/**
* @deprecated Use {@link #phaseTapChangerListForPowerTransformer(String)} instead.
*/
@Deprecated
default String phaseTapChangerForPowerTransformer(String powerTransformerId) {
return phaseTapChangerListForPowerTransformer(powerTransformerId).stream().filter(Objects::nonNull).findFirst().orElse(null);
}

default List<String> ratioTapChangerListForPowerTransformer(String powerTransformerId) {
return Collections.singletonList(ratioTapChangerForPowerTransformer(powerTransformerId));
}

default List<String> phaseTapChangerListForPowerTransformer(String powerTransformerId) {
return Collections.singletonList(phaseTapChangerForPowerTransformer(powerTransformerId));
}
List<String> ratioTapChangerListForPowerTransformer(String powerTransformerId);

// TODO(Luma) refactoring node-breaker conversion temporal
List<String> phaseTapChangerListForPowerTransformer(String powerTransformerId);

/**
* Obtain the substation of a given terminal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@

import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
import java.util.*;
import java.util.function.Consumer;

/**
Expand Down Expand Up @@ -349,7 +345,6 @@ public PropertyBags terminals() {

@Override
public PropertyBags connectivityNodeContainers() {
// TODO(Luma) refactoring node-breaker conversion temporal
return new PropertyBags();
}

Expand Down Expand Up @@ -504,6 +499,16 @@ public PropertyBags phaseTapChangerTable(String tableId) {
return new PropertyBags();
}

@Override
public List<String> ratioTapChangerListForPowerTransformer(String powerTransformerId) {
return Collections.emptyList();
}

@Override
public List<String> phaseTapChangerListForPowerTransformer(String powerTransformerId) {
return Collections.emptyList();
}

@Override
public PropertyBags acDcConverters() {
return acDcConverters;
Expand Down Expand Up @@ -592,24 +597,6 @@ public CgmesDcTerminal dcTerminal(String dcTerminalId) {
return null;
}

/**
* @deprecated Use {@link #ratioTapChangerListForPowerTransformer(String)} instead.
*/
@Override
@Deprecated
public String ratioTapChangerForPowerTransformer(String powerTransformerId) {
return null;
}

/**
* @deprecated Use {@link #phaseTapChangerListForPowerTransformer(String)} instead.
*/
@Override
@Deprecated
public String phaseTapChangerForPowerTransformer(String powerTransformerId) {
return null;
}

@Override
public String substation(CgmesTerminal t, boolean nodeBreaker) {
return null;
Expand All @@ -632,27 +619,26 @@ public double nominalVoltage(String baseVoltageId) {

@Override
public void setBasename(String baseName) {
// TODO Review if required by current tests
// Not required by current tests
}

@Override
public String getBasename() {
// TODO Review if required by current tests
return null;
}

@Override
public void read(ReadOnlyDataSource ds, Reporter reporter) {
// TODO Review if required by current tests
// Not required by current tests
}

@Override
public void read(ReadOnlyDataSource mainDataSource, ReadOnlyDataSource alternativeDataSourceForBoundary, Reporter reporter) {
// TODO Review if required by current tests
// Not required by current tests
}

@Override
public void read(InputStream is, String baseName, String contextName, Reporter reporter) {
// TODO Review if required by current tests
// Not required by current tests
}
}
36 changes: 0 additions & 36 deletions iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Bus.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,57 +114,21 @@ default Bus setFictitiousQ0(double q0) {
*/
Iterable<TwoWindingsTransformer> getTwoWindingsTransformers();

/**
* Get 2 windings transformer connected to the bus.
* @deprecated Use {@link #getTwoWindingsTransformers()} instead.
*/
@Deprecated
default Iterable<TwoWindingsTransformer> getTwoWindingTransformers() {
return getTwoWindingsTransformers();
}

/**
* Get 2 windings transformer connected to the bus.
*/
Stream<TwoWindingsTransformer> getTwoWindingsTransformerStream();

/**
* Get 2 windings transformer connected to the bus.
* @deprecated Use {@link #getTwoWindingsTransformerStream()} instead.
*/
@Deprecated
default Stream<TwoWindingsTransformer> getTwoWindingTransformerStream() {
return getTwoWindingsTransformerStream();
}

/**
* Get 3 windings transformers connected to the bus.
*/
Iterable<ThreeWindingsTransformer> getThreeWindingsTransformers();

/**
* Get 3 windings transformers connected to the bus.
* @deprecated Use {@link #getThreeWindingsTransformers()} instead.
*/
@Deprecated
default Iterable<ThreeWindingsTransformer> getThreeWindingTransformers() {
return getThreeWindingsTransformers();
}

/**
* Get 3 windings transformers connected to the bus.
*/
Stream<ThreeWindingsTransformer> getThreeWindingsTransformerStream();

/**
* Get 3 windings transformers connected to the bus.
* @deprecated Use {@link #getThreeWindingsTransformerStream()} instead.
*/
@Deprecated
default Stream<ThreeWindingsTransformer> getThreeWindingTransformerStream() {
return getThreeWindingsTransformerStream();
}

/**
* Get generators connected to the bus.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ public interface Identifiable<I extends Identifiable<I>> extends Extendable<I> {
*/
String getId();

/**
* Get the name of the object if it exists. If not, get the unique identifier of the object.
*
* @deprecated Use {@link #getNameOrId()} or {@link #getOptionalName()} instead.
*/
@Deprecated
default String getName() {
return getNameOrId();
}

/**
* Get the aliases of the object.
*/
Expand Down Expand Up @@ -135,16 +125,6 @@ default I setName(String name) {
*/
boolean hasProperty();

/**
* Get properties associated to the object.
*
* @deprecated Use {@link #getProperty(String)} & {@link #setProperty(String, String)} instead.
*/
@Deprecated
default Properties getProperties() {
throw new UnsupportedOperationException("Deprecated");
}

/**
* Check that this object has property with specified name.
*/
Expand Down
Loading