Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency com.powsybl:powsybl-starter to v2024.1.0 #90

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-starter</artifactId>
<version>2024.0.1</version>
<version>2024.1.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 11 additions & 10 deletions src/main/Solver.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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()
}

Expand Down Expand Up @@ -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<SensitivityVariableSet> = listOf()
val contingencies = contingenciesList.getContingencies(network)

Expand Down Expand Up @@ -152,7 +153,7 @@ fun runSecurityAnalysis(
actions: List<Action>,
monitors: List<StateMonitor>,
): LoadFlowServiceSecurityAnalysisResult {
val reporter = ReporterModel("security", "")
val reporter = ReportNode.newRootReportNode().withMessageTemplate("security", "").build()
val securityReport =
SecurityAnalysis.run(
network,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ class ExternalNetworkResourceHandler(
return Json.decodeFromString<SparqlResultJson>(response.body())
}

// Used for testing
fun tripleStoreQuery(query: String): PropertyBags = tripleStore.query(query)
}
Loading