Skip to content

Commit

Permalink
docs: Add documentation for sensitivity analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkleiven committed Mar 7, 2024
1 parent 279100a commit d50312a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/formItemHandlers/ContingencyListContainer.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.statnett.loadflowservice.formItemHandlers

import com.github.statnett.loadflowservice.formItemHandlers.FormItemNames.Companion.CONTINGENCIES
import com.powsybl.contingency.ContingenciesProvider
import com.powsybl.contingency.Contingency
import com.powsybl.contingency.contingency.list.ContingencyList
Expand All @@ -25,7 +26,7 @@ class ContingencyListContainer : AutoVersionableJsonParser(), FormItemLoadable,

override fun formItemHandler(part: PartData.FormItem) {
val name = part.name ?: ""
if (name == "contingencies") {
if (name == CONTINGENCIES) {
this.update(part.value)
logger.info { "Received contingencies: ${part.value}" }
}
Expand Down
1 change: 1 addition & 0 deletions src/main/formItemHandlers/FormItemNames.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ class FormItemNames {
const val SENSITIVITY_ANALYSIS_PARAMS = "sensitivity-analysis-params"
const val SENSITIVITY_FACTORS = "sensitivity-factors"
const val SECURITY_ANALYSIS_PARAMS = "security-analysis-params"
const val CONTINGENCIES = "contingencies"
}
}
53 changes: 50 additions & 3 deletions src/main/resources/openapi/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ paths:
description: Run load flow calculation
requestBody:
$ref: '#/components/networkFile'
load-flow-params: Solver parameters. See /default-values/load-flow-params


responses:
Expand Down Expand Up @@ -118,6 +117,23 @@ paths:
500:
$ref: '#/components/internalError'

/sensitivity-analysis:
post:
description: Run a sensitivity analysis. See https://www.powsybl.org/pages/documentation/simulation/sensitivity/
requestBody:
$ref: '#/components/networkFile'

responses:
200:
description: Result of the sensitivity analysis
content:
application/json:
type: object
422:
$ref: '#/components/missingNetworkFileResponse'
500:
$ref: '#/components/internalError'


components:
schemas:
Expand All @@ -134,9 +150,23 @@ components:
type: double
reactivePower:
type: double
sensitivity-factor:
type: object
properties:
functionType:
type: string
functionId:
type: string
variableType:
type: string
variableId:
type: string
variableSet:
type: bool
contingencyContextType:
type: string
networkFile:
description: Form with network data sent as file
required: true
content:
multipart/form-data:
schema:
Expand All @@ -145,6 +175,24 @@ components:
network:
type: string
format: binary
load-flow-params:
type: object
description: Parameters for load flow calculations. Has effect for /run-load-flow and /sensitivity-analysis). See default-values/load-flow-params for possible fields
sensitivity-analysis-params:
type: object
description: Parameters for sensitivity analysis. Has effect for /sensitivity-analysis. See /default-values/sensitivity-analysis-parameters for possible fields
sensitivity-factors:
type: array
description: Sensitivity factors. Has effect for /sensitivity-analysis
items:
$ref: '#/components/schemas/sensitivity-factor'
contingencies:
type: array
description: Contingencies. Has effect for /sensitivity-analysis
items:
type: object
required:
- network
missingNetworkFileResponse:
description: No network file provided
content:
Expand All @@ -162,4 +210,3 @@ components:
content:
image/svg+xml:
type: string

3 changes: 2 additions & 1 deletion src/test/testDataFactory/SensitivityRunFactory.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package testDataFactory

import com.github.statnett.loadflowservice.formItemHandlers.AutoSerializableSensitivityFactor
import com.github.statnett.loadflowservice.formItemHandlers.FormItemNames.Companion.CONTINGENCIES
import com.github.statnett.loadflowservice.formItemHandlers.FormItemNames.Companion.LOAD_FLOW_PARAMS
import com.github.statnett.loadflowservice.formItemHandlers.FormItemNames.Companion.SENSITIVITY_ANALYSIS_PARAMS
import com.github.statnett.loadflowservice.formItemHandlers.FormItemNames.Companion.SENSITIVITY_FACTORS
Expand Down Expand Up @@ -106,7 +107,7 @@ fun sensFactors(): List<PartData> {
fun contingencies(): List<PartData> {
return formData {
append(
"contingencies",
CONTINGENCIES,
Json.encodeToString(ieee14BusContingencies()),
)
}
Expand Down

0 comments on commit d50312a

Please sign in to comment.