From df530474a6f7b2bfb665c2676169ea6147aae86d Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 13 Apr 2024 12:50:41 +0000
Subject: [PATCH 1/2] fix(deps): update dependency com.powsybl:powsybl-starter
to v2024.1.0
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 0632540..0f4396d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
com.powsybl
powsybl-starter
- 2024.0.1
+ 2024.1.0
From ca32fe2a8c87ce6d0e3856a039f37d99b9e5e216 Mon Sep 17 00:00:00 2001
From: David Kleiven
Date: Sun, 14 Apr 2024 12:13:23 +0200
Subject: [PATCH 2/2] fix: Fix breaking changes from last powsybl release
---
src/main/App.kt | 2 +-
src/main/Solver.kt | 21 ++++++++++---------
.../ExternalNetworkResourceHandler.kt | 1 +
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/main/App.kt b/src/main/App.kt
index 0d7a32a..32d9f3b 100644
--- a/src/main/App.kt
+++ b/src/main/App.kt
@@ -6,7 +6,7 @@ import com.github.statnett.loadflowservice.formItemHandlers.MultiFormItemLoaders
import com.github.statnett.loadflowservice.formItemHandlers.SecurityAnalysisParametersContainer
import com.github.statnett.loadflowservice.formItemHandlers.SensitivityAnalysisParametersContainer
import com.github.statnett.loadflowservice.formItemHandlers.SensitivityFactorContainer
-import com.powsybl.security.action.Action
+import com.powsybl.action.Action
import com.powsybl.security.interceptors.SecurityAnalysisInterceptor
import com.powsybl.security.monitor.StateMonitor
import com.powsybl.security.strategy.OperatorStrategy
diff --git a/src/main/Solver.kt b/src/main/Solver.kt
index 4575771..b5389f6 100644
--- a/src/main/Solver.kt
+++ b/src/main/Solver.kt
@@ -1,9 +1,9 @@
package com.github.statnett.loadflowservice
import com.fasterxml.jackson.databind.ObjectMapper
+import com.powsybl.action.Action
import com.powsybl.commons.PowsyblException
-import com.powsybl.commons.reporter.Reporter
-import com.powsybl.commons.reporter.ReporterModel
+import com.powsybl.commons.report.ReportNode
import com.powsybl.computation.local.LocalComputationManager
import com.powsybl.contingency.ContingenciesProvider
import com.powsybl.contingency.contingency.list.ContingencyList
@@ -18,7 +18,6 @@ import com.powsybl.loadflow.json.LoadFlowParametersJsonModule
import com.powsybl.security.LimitViolationFilter
import com.powsybl.security.SecurityAnalysis
import com.powsybl.security.SecurityAnalysisParameters
-import com.powsybl.security.action.Action
import com.powsybl.security.detectors.DefaultLimitViolationDetector
import com.powsybl.security.interceptors.SecurityAnalysisInterceptor
import com.powsybl.security.monitor.StateMonitor
@@ -61,7 +60,7 @@ fun networkFromFileContent(content: NamedNetworkSource): Network {
val importConfig = ImportConfig.CACHE.get()
val loader = ImportersServiceLoader()
- val reporter = Reporter.NO_OP
+ val reporter = ReportNode.NO_OP
val computationManager = LocalComputationManager.getDefault()
val dataSource = content.asReadOnlyDataSource()
val importer = Importer.find(dataSource, loader, computationManager, importConfig)
@@ -84,14 +83,16 @@ fun loadFlowTaskName(): String {
return "load-flow"
}
-fun loadFlowReporter(): ReporterModel {
+fun loadFlowReporter(): ReportNode {
val name = loadFlowTaskName()
- return ReporterModel(name, name)
+ return ReportNode.newRootReportNode().withMessageTemplate(name, name).build()
}
-fun reporterToString(reporter: ReporterModel): String {
+fun reporterToString(reporter: ReportNode): String {
val writer = StringWriter()
- reporter.export(writer)
+
+ // Check if we should use reporter writeJson instead
+ reporter.print(writer)
return writer.toString()
}
@@ -122,7 +123,7 @@ fun runSensitivityAnalysis(
params: SensitivityAnalysisParameters,
contingenciesList: ContingencyList,
): LoadFlowServiceSensitivityAnalysisResult {
- val reporter = ReporterModel("sensitivity", "")
+ val reporter = ReportNode.newRootReportNode().withMessageTemplate("sensitivity", "").build()
val variableSets: List = listOf()
val contingencies = contingenciesList.getContingencies(network)
@@ -152,7 +153,7 @@ fun runSecurityAnalysis(
actions: List,
monitors: List,
): LoadFlowServiceSecurityAnalysisResult {
- val reporter = ReporterModel("security", "")
+ val reporter = ReportNode.newRootReportNode().withMessageTemplate("security", "").build()
val securityReport =
SecurityAnalysis.run(
network,
diff --git a/src/main/formItemHandlers/ExternalNetworkResourceHandler.kt b/src/main/formItemHandlers/ExternalNetworkResourceHandler.kt
index a1936f8..a5eaa83 100644
--- a/src/main/formItemHandlers/ExternalNetworkResourceHandler.kt
+++ b/src/main/formItemHandlers/ExternalNetworkResourceHandler.kt
@@ -85,5 +85,6 @@ class ExternalNetworkResourceHandler(
return Json.decodeFromString(response.body())
}
+ // Used for testing
fun tripleStoreQuery(query: String): PropertyBags = tripleStore.query(query)
}