-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
add1d7c
commit 11c13a5
Showing
3 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.github.statnett</groupId> | ||
<artifactId>load-flow-service</artifactId> | ||
<version>0.0.0</version> | ||
<properties> | ||
<kotlin.version>1.9.10</kotlin.version> | ||
<ktor.version>2.3.4</ktor.version> | ||
<main.class>com.github.statnett.loadflowservice.AppKt</main.class> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>ktor-eap</id> | ||
<url>https://maven.pkg.jetbrains.space/public/p/ktor/eap</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.powsybl</groupId> | ||
<artifactId>powsybl-starter</artifactId> | ||
<version>2023.2.4</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-core-jvm</artifactId> | ||
<version>${ktor.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-netty-jvm</artifactId> | ||
<version>${ktor.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<sourceDirectory>${project.basedir}/src/main</sourceDirectory> | ||
<testSourceDirectory>${project.basedir}/src/test</testSourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-plugin</artifactId> | ||
<version>${kotlin.version}</version> | ||
|
||
<extensions>true</extensions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>3.6.0</version> | ||
<executions> | ||
<execution> | ||
<id>make-assembly</id> | ||
<phase>package</phase> | ||
<goals> <goal>single</goal> </goals> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>${main.class}</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.github.statnett.loadflowservice | ||
|
||
import io.ktor.server.application.* | ||
import io.ktor.server.response.* | ||
import io.ktor.server.routing.* | ||
import io.ktor.server.engine.* | ||
import io.ktor.server.netty.* | ||
|
||
fun main() { | ||
embeddedServer(Netty, port = 8080) { | ||
routing { | ||
get("/") { | ||
call.respondText("Hello, world!") | ||
} | ||
} | ||
}.start(wait = true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.statnett.loadflowservice | ||
|
||
import com.powsybl.iidm.network.Network | ||
import com.powsybl.loadflow.LoadFlowParameters | ||
import com.powsybl.loadflow.LoadFlow | ||
import java.io.InputStream | ||
|
||
fun networkFromStream(fname: String, content: InputStream): Network { | ||
return Network.read(fname, content) | ||
} | ||
|
||
fun solve(network: Network, parameters: LoadFlowParameters) { | ||
LoadFlow.run(network, parameters); | ||
} |