Skip to content

Migration guide v3.0.0

MioRtia edited this page Oct 23, 2019 · 25 revisions

Configuration Changes

The PlatformConfig.defaultConfig() method now requires the user to choose an implementation of the new PlatformConfigProvider interface. To fix the exception, you must add one of the following dependency to your pom.xml:

For all usages but tests:

<dependency>
  <groupId>com.powsybl</groupId>
  <artifactId>powsybl-config-classic</artifactId>
  <version>3.0.0</version>
</dependency>

For tests:

<dependency>
  <groupId>com.powsybl</groupId>
  <artifactId>powsybl-config-test</artifactId>
  <version>3.0.0</version>
  <scope>test</scope>
</dependency>

Loadflow API change

  • LoadFlowFactory has been removed.
  • Loadflow implementations must inherit from LoadFlowProvider and not LoadFlow anymore and configured to be accessible though java.util.ServiceLoader.
  • LoadFlow is now a utility class which the the unique entry point for running a loaflow.

To run a loadflow using default implementation:

LoadFlowResult result = LoadFlow.run(network);

To run a loaflow using a specific implementation:

LoadFlowResult result = LoadFlow.find("MyLf").run(network);

Default implementation is chosen using the following rules:

  • if no implementation is found an exception is raised.
  • if only one implementation of LoadFlowProvider is found in the classpath, it is the default implementation
  • if more than one implementation is found in the classpath, additional configuration is needed in the platform config to select to default implementation by its name:
load-flow:
    default: MyLf

Deprecated getMaximumB() in ShuntCompensator

The method getMaximumB() in ShuntCompensator interface has been deprecated. From now, replace your code as below:

double maxB = shuntCompensator.getMaximumB();

should become:

double maxB = shuntCompensator.getbPerSection() * shuntCompensator.getMaximumSectionCount();

ValidationWriterFactory::create with a TableFormatterConfig argument

The recently added (in powsybl 2.5.0) ValidationWriterFactory::create method which takes a TableFormatterConfig argument has been removed. The deprecated overload of ValidationWriterFactory::create which does not take a TableFormatterConfig argument has been undeprecated and should be reused instead.

Replace getProperties() in Identifiable by setProperty() and getProperty()

The method getProperties() in Identifiable, used to get and update properties of an Identifiable object, has been deprecated. From now, replace your code as below:

generator.getProperties().put("name", "value");

should become:

generator.setProperty("name", "value");

and

String value = generator.getProperties().getProperty("name");

should become:

String value = generator.getProperty("name");

Clone this wiki locally