-
Notifications
You must be signed in to change notification settings - Fork 41
Migration guide v2.5.0
The modules cim1-converter
and cim1-model
were deleted in this version. In order to import CIM14 files, now use the CGMES converter with the modules cgmes-conversion
and cgmes-model
. They handle the modeling and conversion of CIM14 and CIM16 files.
The create
methods in ContingenciesProviderFactory
interface do not return generic types anymore. It can be an issue if the generic type is explicit in the method call:
class MyContingenciesProviderImpl implements ContingenciesProvider {
... // code
}
public void myMethod() {
ContingenciesProviderFactory factory = ... // creation of an instance of ContingenciesProviderFactory
// error in this version
MyContingenciesProviderImpl myContingenciesProviderImpl = factory.<MyContingenciesProviderImpl>create();
}
As a workaround, you can either try to cast as your wanted type if possible:
class MyContingenciesProviderImpl implements ContingenciesProvider {
... // code
}
public void myMethod() {
ContingenciesProviderFactory factory = ... // creation of an instance of ContingenciesProviderFactory
// no error if this is indeed a MyContingenciesProviderImpl instance
MyContingenciesProviderImpl myContingenciesProviderImpl = (MyContingenciesProviderImpl) factory.create();
}
or explicitly create an implementation of ContingenciesProviderFactory
whose create
method returns MyContingenciesProviderImpl
:
class MyContingenciesProviderImpl implements ContingenciesProvider {
... // code
}
class MyContingenciesProviderFactoryImpl implements ContingenciesProviderFactory {
@Override
public MyContingenciesProviderImpl create() {
... // code creating and returning an instance of MyContingenciesProviderImpl
}
... // code
}
public void myMethod() {
MyContingenciesProviderFactoryImpl factory = ... // creation of an instance of MyContingenciesProviderFactoryImpl
// no error
MyContingenciesProviderImpl myContingenciesProviderImpl = factory.create();
}
The methods getShunts
and getShuntStream
of the Bus
interface and the methods newShunt
, getShunts
and getShuntStream
of the VoltageLevel
interface are now deleted.
Respectively use:
-
bus.getShuntCompensators()
instead ofbus.getShunts()
-
bus.getShuntCompensatorStream()
instead ofbus.getShuntStream()
-
voltageLevel.newShuntCompensator()
instead ofvoltageLevel.newShunt()
-
voltageLevel.getShuntCompensators()
instead ofvoltageLevel.getShunts()
-
voltageLevel.getShuntCompensatorStream()
instead ofvoltageLevel.getShuntStream()
Before this version, the Networks.loadNetwork()
returns null
if no compatible importer is found in the class path. A NullPointerException
might be thrown if the developer forgot to check if the Network was null.
From this version, a PowsyblException
is thrown.
In the following example, the test is not needed anymore.
Network network = Importers.loadNetwork(caseFile, context.getShortTimeExecutionComputationManager(), importConfig, inputParams);
if (network == null) {
throw new PowsyblException("Case '" + caseFile + "' not found");
}
For fictitious substations (XNodes, tutorials, fictitious networks...), we had to set the country of substations to an arbitrary value. From this version, the country is an optional. We chose to break the Substation
API to avoid returning an arbitrary value (valid country or null value) and generate side effects in the existing codes. The existing code is responsible to deal with optional countries.
The following code:
Country country = substation.getCountry();
can be replaced by one of the following lines:
// If null values are allowed
Country country1 = substation.getCountry().orElse(null);
// If null values are not allowed
Country country = substation.getCountry().orElseThrow(() -> new RuntimeException());
Several methods of the Matrix
interface have been deprecated and will be removed in a next version. You can change your code to use the new API, and avoid compilation issue. Respectively use:
-
matrix.getRowCount()
instead ofmatrix.getM()
-
matrix.getColumnCount()
instead ofmatrix.getN()
-
matrix.get()
instead ofmatrix.getValue()
-
matrix.set()
instead ofmatrix.setValue()
-
matrix.add()
instead ofmatrix.addValue()
The LimitViolationDetector
implementations have been moved to the new com.powsybl.security.detectors
package. The existing classes have been deprecated and will be removed in a next version.
The DistributedSecurityAnalysis
and ExternalSecurityAnalysis
have been deprecated and will be removed in a next version. Respectively use DistributedSecurityAnalysisExecution
and ForwardedSecurityAnalysisExecution
instead. The SecurityAnalysisExecutionInput
and SecurityAnalysisExecution
classes have been created to clearly separate the inputs from the execution mode of the security analysis.
We also add the SecurityAnalysisExecutionHandlers
utility class to create the SecurityAnalysisExecution
instance in distributed or forwarded mode.
In this version, check
methods in loadflow-validation
are not static anymore. For example, instead of:
FlowsValidation.checkFlows(network, config, writer);
use:
FlowsValidation.INSTANCE.checkFlows(network, config, writer);
The java classes affected by this change are:
BusesValidation
FlowsValidation
GeneratorsValidation
ShuntCompensatorsValidation
StaticVarCompensatorsValidation
Transformers3WValidation
TransformersValidation