-
Notifications
You must be signed in to change notification settings - Fork 43
Migration guide v3.1.0
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.
After the changes in powsybl configuration, most constructors using a TableFormatterConfig
argument have been deleted. You should now use the constructors without TableFormatterConfig
and configure table-formatter-config
using the implementation of PlatformConfigProvider
.
Add following module in dependencies if using ActionScript
.
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-action-dsl-afs</artifactId>
<version>3.1.0</version>
</dependency>
Add following module in dependencies if using ContingencyStore
.
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-contingency-afs</artifactId>
<version>3.1.0</version>
</dependency>
In the itools.conf
file, several paths can be written in the powsybl_config_dirs
parameter, indicating the different paths that can contains configuration files or the logback-itools.xml
file.
The separator between paths used to be :
and is now the File.pathSeparator
which depends on your OS: it is :
for Unix systems and ;
for Windows systems.
Furthermore, the path used in priority to retrieve the logback-itools.xml
file is the first written path (furthest into the left) to be consistent with the reading of configuration files.
Groovy is upgraded to the latest stable: groovy 2.5.8. The following groovy modules are no longer included:
- groovy-ant
- groovy-bsf
- groovy-groovydoc
- groovy-jmx
- groovy-jsr223
- groovy-servlet
- groovy-sql
- groovy-test
- groovy-testng (note that the groovy modules were included before, but their transitive dependencies were not. As a consequence, most of them would not work at runtime)
The way AFS elements are serialized/deserialized within MapDB has evolved in order to anticipate further modifications of the AFS model. This modification does not maintain compatibility with previous versions of powsybl. Therefore, AFS data stored within MapDB using a previous version of powsybl will no longer be readable with V3.1.0.
Afs EventBus
is a new notification system that was added to manage Afs Events (Storage Events & Business Events).
Each AppStorage
Implementation should have an EventBus
to which it sends all its events.
The EventBus
Interface give us the possibility to add any message broker (kafka, rabbitMQ ...) we want, to be used as an eventBus for our application.
Note: ListenableAppStorage
and ForwardingAppStorage
are no longer used, we kept them to maintain a backward compatibility with client applications, use AppStorage instead and use AppSTorage.getEventBus().addListener(AppStorageListener l)
to add listeners to an AppStorage
.
First, the API does not allow multiple causes anymore. They were not correctly handled, in particular in messages and stack trace, not documented, and not used in the framework. It was finally not a good design. Use cases are not obvious : even when there are multiple command executions, usually only one exception is raised.
In the case where the feature was still used, it's possible to :
- have a specific processing to first "merge" the exceptions. The new possibility to add a specific message to the exception may help to give some information in the created computation exception.
- use the
addSuppressedException
method of the computation exception, in order to keep information about those exceptions and have them reported in the stack trace.
Second, the constructor for wrapping another computation exception and an additional cause has also been removed, since the use case was not clear and the behaviour was not documented. If really needed, an equivalent result can be reached by using the usual builder :
ComputationException wrapper = new ComputationException(computationException, other);
may be replaced by the use of the usual builder:
ComputationExceptionBuilder builder = new ComputationExceptionBuilder(other);
computationException.getOutLogs().forEach((name, log) -> builder.addOutLog(name, log));
...
ComputationException wrapper = builder.build();
To avoid a dependency on Groovy runtime in powsybl-commons, this utility class have been removed and partially replaced by AstUtil in powsybl-dsl module (AST print for AST transformation debugging).
The classes LegBase
, Leg1
and Leg2or3
have been replaced now by the new class Leg
and the classes Leg1Adder
and Leg2or3Adder
are now LegAdder
.
In the previous version of IIDM, only Leg1
had attributes G and B, and only Leg2or3
could have a Ratio Tap Changer associated.
From this version, all three legs are identical and all of them have G and B and can have a Ratio Tap Changer and/or a Phase Tap Changer associated. Rated voltage of the star bus has been added as an explicit attribute (ratedU0). By default, it is equal to the rated voltage of leg 1.
The CGMES conversion has not been modified in this version. Only data compatible with previous modelling is used. Only G and B of Leg1
and the RatioTapChanger
of the Leg2 and Leg3 are used in the CGMES conversion. The values of G and B on Legs 2 and 3 are initialized to zero.
References to classes LegBase
, Leg1
and Leg2or3
should be replaced by Leg
. Some examples are provided:
private void compareLeg(ThreeWindingsTransformer.LegBase expected, ThreeWindingsTransformer.LegBase actual)
...
Leg1 leg1 = Mockito.mock(Leg1.class);
Leg2or3 leg2 = Mockito.mock(Leg2or3.class);
should be changed by
private void compareLeg(ThreeWindingsTransformer.Leg expected, ThreeWindingsTransformer.Leg actual)
...
Leg leg1 = Mockito.mock(Leg.class);
Leg leg2 = Mockito.mock(Leg.class);
References to LegAdder<?> adder
, Leg1Adder
and Leg2or3Adder
should be replaced by LegAdder
, some examples:
public void connect(LegAdder<?> adder, int terminal)
...
LegAdder<Leg1Adder> l1adder = txadder.newLeg1();
LegAdder<Leg2or3Adder> l2adder = txadder.newLeg2();
LegAdder<Leg2or3Adder> l3adder = txadder.newLeg3();
should be changed by
public void connect(LegAdder adder, int terminal)
...
LegAdder l1adder = txadder.newLeg1();
LegAdder l2adder = txadder.newLeg2();
LegAdder l3adder = txadder.newLeg3();
powsybl-scripting
module has been split in two parts. Every AFS relative classes or interfaces have been moved to a new powsybl-afs-scripting module. If you want to use scripting without AFS, you don't have to change anything. If you want to use AFS in your scripts, please add powsybl-afs-scripting
to your dependencies.
All AFS modules have been moved to a new powsybl-afs repository. Some modules or packages have been renamed:
The module's name changed from powsybl-action-dsl-afs
to powsybl-afs-action-dsl
.
The package's name changed from com.powsybl.action.dsl.afs
to com.powsybl.afs.action.dsl
The module's name changed from powsybl-contingency-afs
to powsybl-afs-contingency
.
The package's name changed from com.powsybl.contingency.afs
to com.powsybl.afs.contingency
The module's names changed from powsybl-security-analysis-afs
to powsybl-afs-security-analysis
and from powsybl-security-analysis-afs-local
to powsybl-security-afs-analysis-local
.
The package's names changed from com.powsybl.security.afs
to com.powsybl.afs.security
and from com.powsybl.security.afs.local
to com.powsybl.afs.security.local
The groovy-script
option of convert-network
itools command has been removed. It was a useful command for applying a Groovy script to a network file, in order to modify the grid:
$> itools convert-network --input-file n.xiidm --output-format XIIDM --output-file n2.xiidm --groovy-script modif.groovy
It is now possible to do exactly the same thing using only a Groovy code. First we have to create 'modif.groovy' like this:
n = loadNetwork('/tmp/n.xiidm')
// modify the network
saveNetwork('/tmp/n2.xiidm')
Then the groovy script can be executed with the following itools command:
$> itools run-script --file modif.groovy