PowSyBl (Power System Blocks) is an open source framework written in Java, that makes it easy to write complex software for power systems’ simulations and analysis. Its modular approach allows developers to extend or customize its features.
PowSyBl is part of the LF Energy Foundation, a project of The Linux Foundation that supports open source innovation projects within the energy and electricity sectors.
Read more at https://www.powsybl.org !
This project and everyone participating in it is governed by the PowSyBl Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to powsybl-tsc@lists.lfenergy.org.
cd powsybl-network-store
mvn clean install
In your preferred IDE, create a project with following dependencies:
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-client</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-test</artifactId>
<version>6.0.2</version>
</dependency>
Run the Java code to import in IIDM store a programmatic test node/breaker network:
public static void main(String[] args) throws Exception {
String baseUrl = "http://localhost:8080/";
try (NetworkStoreService service = new NetworkStoreService(baseUrl, PreloadingStrategy.NONE)) {
Network network = NetworkTest1Factory.create(service.getNetworkFactory());
}
}
public static void main(String[] args) throws Exception {
String baseUrl = "http://localhost:8080/";
try (NetworkStoreService service = new NetworkStoreService(baseUrl, PreloadingStrategy.NONE)) {
Network network = service.importNetwork(Paths.get("/tmp/network1.xiidm"));
}
}
public static void main(String[] args) throws Exception {
String baseUrl = "http://localhost:8080/";
try (NetworkStoreService service = new NetworkStoreService(baseUrl, PreloadingStrategy.COLLECTION)) {
Network network = service.getNetwork("network1");
for (VoltageLevel vl : network.getVoltageLevels()) {
System.out.println(vl.getId());
}
}
}
@RestController
@RequestMapping(value = "/test")
@ComponentScan(basePackageClasses = {NetworkStoreService.class})
public class TestController {
@Autowired
private NetworkStoreService service;
@RequestMapping(method = GET, produces = APPLICATION_JSON_VALUE)
public List<String> getSubstations(String networkId) {
Network network = service.getNetwork(networkId, PreloadingStrategy.COLLECTION);
return network.getSubstationStream().map(Identifiable::getId).collect(Collectors.toList());
}
}
Network store service could be configured using application.yml like this:
powsybl:
services:
network-store-server:
base-uri: http://localhost:8080/
preloading-strategy: COLLECTION
List of available variables:
Variable | Description | Optional | Default vallue |
---|---|---|---|
powsybl.services.network-store-server.base-uri | URL of the network store server | Yes | http://network-store-server/ |
powsybl.services.network-store-server.preloading-strategy | Preloading strategy | Yes | NONE |
You can run the integration tests:
$ mvn verify