Skip to content

Commit

Permalink
Merge branch 'dev' into jb/#671-externaldataservice
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
#	src/test/scala/edu/ie3/simona/sim/setup/SimonaSetupSpec.scala
  • Loading branch information
jo-bao committed Mar 5, 2024
2 parents 7fba817 + 32b4808 commit 27d4a83
Show file tree
Hide file tree
Showing 58 changed files with 2,895 additions and 2,033 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added smart charging logic [#31](https://github.com/ie3-institute/simona/issues/31) and flex calculation in `EvcsAgent` [#332](https://github.com/ie3-institute/simona/issues/332)
- Enhance output quotes of `RunSimona` [#743](https://github.com/ie3-institute/simona/issues/743)
- Printing logs of failed tests [#747](https://github.com/ie3-institute/simona/issues/747)
- Models for measurements within the grid structure [#89](https://github.com/ie3-institute/simona/issues/89)
- Config possibility for transformer control groups [#90](https://github.com/ie3-institute/simona/issues/90)

### Changed
- Adapted to changed data source in PSDM [#435](https://github.com/ie3-institute/simona/issues/435)
Expand All @@ -39,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Unified consideration of scaling factor when simulating system participants [#81](https://github.com/ie3-institute/simona/issues/81)
- Small improvements in `ResultEventListener` [#738](https://github.com/ie3-institute/simona/issues/738)
- Converting `SimonaSim` to pekko typed/terminating SimonSim when initialization fails [#210](https://github.com/ie3-institute/simona/issues/210)
- Converting the `GridAgent` and the `DBFSAlgorithm` to `pekko typed` [#666](https://github.com/ie3-institute/simona/issues/666)

### Fixed
- Removed a repeated line in the documentation of vn_simona config [#658](https://github.com/ie3-institute/simona/issues/658)
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
id 'pmd' // code check, working on source code
id 'com.diffplug.spotless' version '6.25.0'// code format
id "com.github.ben-manes.versions" version '0.51.0'
id "de.undercouch.download" version "5.5.0" // downloads plugin
id "de.undercouch.download" version "5.6.0" // downloads plugin
id "kr.motd.sphinx" version "2.10.1" // documentation generation
id "com.github.johnrengelman.shadow" version "8.1.1" // fat jar
id "org.sonarqube" version "4.4.1.3373" // sonarqube
Expand All @@ -24,12 +24,12 @@ ext {
javaVersion = JavaVersion.VERSION_17

scalaVersion = '2.13'
scalaBinaryVersion = '2.13.12'
pekkoVersion = '1.0.1'
scalaBinaryVersion = '2.13.13'
pekkoVersion = '1.0.2'
jtsVersion = '1.19.0'
confluentKafkaVersion = '7.4.0'
tscfgVersion = '1.0.0'
scapegoatVersion = '2.1.3'
scapegoatVersion = '2.1.5'

testContainerVersion = '0.41.3'

Expand Down Expand Up @@ -102,12 +102,12 @@ dependencies {

/* logging */
implementation "com.typesafe.scala-logging:scala-logging_${scalaVersion}:3.9.5" // pekko scala logging
implementation "ch.qos.logback:logback-classic:1.5.0"
implementation "ch.qos.logback:logback-classic:1.5.3"

/* testing */
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
testImplementation 'org.scalatestplus:mockito-3-4_2.13:3.2.10.0'
testImplementation 'org.mockito:mockito-core:5.10.0' // mocking framework
testImplementation 'org.mockito:mockito-core:5.11.0' // mocking framework
testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.18"
testRuntimeOnly 'com.vladsch.flexmark:flexmark-all:0.64.8' //scalatest html output
testImplementation group: 'org.pegdown', name: 'pegdown', version: '1.6.0'
Expand Down
39 changes: 39 additions & 0 deletions docs/readthedocs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,42 @@ Secondary convergence criterion for the power flow calculation is the number of
Resolution of the power flow calculation:

`simona.powerflow.resolution = "3600s"`

## Transformer Control Group configuration

It's possible to add a voltage control function to a transformer or group of transformers. This requires measurements within the network to be under voltage control and at least one corresponding transformer.
The voltage control will attempt to adjust the voltage by changing the tap position of the corresponding transformer. If changing the tap position would cause a voltage limit to be exceeded, the initial voltage deviation cannot be reduced by the voltage control system.

Transformer control groups must contain at least one transformer and one measurement. And can be configured as shown in this example for two transformer control groups:
```
simona.control.transformer = [
{
transformers = ["31a2b9bf-e785-4475-aa44-1c34646e8c79"],
measurements = ["923f2d69-3093-4198-86e4-13d2d1c220f8"],
vMin = 0.98,
vMax = 1.02
}
, {
transformers = ["1132dbf4-e8a1-44ae-8415-f42d4497aa1d"],
measurements = ["7686b818-a0ba-465c-8e4e-f7d3c4e171fc"],
vMin = 0.98,
vMax = 1.02
}
]
```

UUID of transformer in control group:

`transformers = ["31a2b9bf-e785-4475-aa44-1c34646e8c79"]`

UUID of measurement in control group:

`measurements = ["923f2d69-3093-4198-86e4-13d2d1c220f8"]`

Minimum Voltage Limit in p.u.:

`vMin = 0.98`

Maximum Voltage Limit in p.u.:

`vMax = 1.02`
8 changes: 8 additions & 0 deletions docs/readthedocs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ models/load_model
models/pv_model
models/wec_model
```

## Measurement and Control
```{toctree}
---
maxdepth: 1
---
models/measurement_control
```
2 changes: 1 addition & 1 deletion docs/readthedocs/models/cts_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This storage model operates on volumes, although the functions it provides for o

## Attributes, Units and Remarks

Please refer to {doc}`PowerSystemDataModel - CTS Model <psdm:models/input/participant/cylindricalstorage>` for Attributes and Units used in this Model.
Please refer to {doc}`PowerSystemDataModel - CTS Model <psdm:models/input/thermal/cylindricalstorage>` for Attributes and Units used in this Model.

## Calculations
### Maximal storage capacity
Expand Down
5 changes: 5 additions & 0 deletions docs/readthedocs/models/measurement_control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(measurement_control)=

# Transformer Control Groups

Transformer control group can be used to implement control functionalities like long-range control for active voltage stability. For this purpose, network areas and transformers can be logically linked to a control group via measuring points. If a deviation from the target voltage magnitude is detected at one of the measuring points, the transformer is switched to the appropriate tap position to solve the deviation, provided that no limit values are violated at other measuring points. This requires that only measuring points are included in control groups that can also be influenced by the associated transformer.
2 changes: 1 addition & 1 deletion docs/readthedocs/models/thermal_grid_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ The Thermal Grid Model introduces a coupling point to thermal system, equivalent

## Attributes, Units and Remarks

Please refer to {doc}`PowerSystemDataModel - Thermal Bus <psdm:models/input/participant/thermalbus>` for Attributes and Units used in this Model.
Please refer to {doc}`PowerSystemDataModel - Thermal Bus <psdm:models/input/thermal/thermalbus>` for Attributes and Units used in this Model.
2 changes: 1 addition & 1 deletion gradle/scripts/scoverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// https://github.com/scoverage/gradle-scoverage/issues/109 for details

scoverage {
scoverageVersion = "2.0.11"
scoverageVersion = "2.1.0"
scoverageScalaVersion = scalaBinaryVersion
coverageOutputHTML = false
coverageOutputXML = true
Expand Down
14 changes: 14 additions & 0 deletions input/samples/vn_simona/vn_simona.conf
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,17 @@ simona.powerflow.newtonraphson.epsilon = [1E-12]
simona.powerflow.newtonraphson.iterations = 50
simona.powerflow.resolution = "3600s"
simona.powerflow.stopOnFailure = true

simona.control.transformer = [
{
transformers = ["31a2b9bf-e785-4475-aa44-1c34646e8c79"],
measurements = ["923f2d69-3093-4198-86e4-13d2d1c220f8"],
vMin = 0.98,
vMax = 1.02
}, {
transformers = ["1132dbf4-e8a1-44ae-8415-f42d4497aa1d"],
measurements = ["7686b818-a0ba-465c-8e4e-f7d3c4e171fc"],
vMin = 0.98,
vMax = 1.02
}
]
16 changes: 16 additions & 0 deletions src/main/resources/config/config-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ GridOutputConfig {
transformers3w: boolean | false
}

#@define
TransformerControlGroup {
measurements: [string]
transformers: [string]
vMax: Double
vMin: Double
}

##################################################################
# Agentsim
##################################################################
Expand Down Expand Up @@ -333,3 +341,11 @@ simona.event.listener = [
eventsToProcess = [string]
}
]

##################################################################
# Configuration of Control Schemes
##################################################################
#@optional
simona.control = {
transformer = [TransformerControlGroup]
}
20 changes: 15 additions & 5 deletions src/main/scala/edu/ie3/simona/actor/SimonaActorNaming.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

package edu.ie3.simona.actor

import org.apache.pekko.actor.{ActorRef, ActorRefFactory, Props}
import org.apache.pekko.actor.typed.ActorRef
import org.apache.pekko.actor.typed.scaladsl.adapter.TypedActorRefOps
import org.apache.pekko.actor.{ActorRefFactory, Props, ActorRef => ClassicRef}

import java.util.UUID

Expand All @@ -15,10 +17,10 @@ object SimonaActorNaming {
implicit class RichActorRefFactory(private val refFactory: ActorRefFactory)
extends AnyVal {

def simonaActorOf(props: Props, actorId: String): ActorRef =
def simonaActorOf(props: Props, actorId: String): ClassicRef =
refFactory.actorOf(props, actorName(props, actorId))

def simonaActorOf(props: Props): ActorRef =
def simonaActorOf(props: Props): ClassicRef =
refFactory.actorOf(props, actorName(props, simonaActorUuid))
}

Expand Down Expand Up @@ -62,13 +64,13 @@ object SimonaActorNaming {
def actorName(typeName: String, actorId: String): String =
s"${typeName}_${cleanActorIdForPekko(actorId)}"

/** Extracts the actor name from given [[ActorRef]]. Cluster singletons are
/** Extracts the actor name from given [[ClassicRef]]. Cluster singletons are
* taken care of separately.
*
* @return
* the actor name extract from the ActorRef
*/
def actorName(actorRef: ActorRef): String =
def actorName(actorRef: ClassicRef): String =
actorRef.path.name match {
case "singleton" =>
// singletons end in /${actorName}/singleton
Expand All @@ -77,6 +79,14 @@ object SimonaActorNaming {
other
}

/** Extracts the actor name from given [[ActorRef]]. Cluster singletons are
* taken care of separately.
*
* @return
* the actor name extract from the ActorRef
*/
def actorName(actorRef: ActorRef[_]): String = actorName(actorRef.toClassic)

/** Constructs the type name from given props.
*
* @return
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/edu/ie3/simona/agent/EnvironmentRefs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package edu.ie3.simona.agent

import edu.ie3.simona.event.RuntimeEvent
import edu.ie3.simona.ontology.messages.SchedulerMessage
import org.apache.pekko.actor.typed.ActorRef
import org.apache.pekko.actor.{ActorRef => ClassicRef}
Expand All @@ -26,7 +27,7 @@ import org.apache.pekko.actor.{ActorRef => ClassicRef}
*/
final case class EnvironmentRefs(
scheduler: ActorRef[SchedulerMessage],
runtimeEventListener: ClassicRef,
runtimeEventListener: ActorRef[RuntimeEvent],
primaryServiceProxy: ClassicRef,
weather: ClassicRef,
evDataService: Option[ClassicRef],
Expand Down
Loading

0 comments on commit 27d4a83

Please sign in to comment.