Skip to content

Commit

Permalink
Merge branch 'dev' into sp/#242-kafka-runtime-sink
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-peter committed Jul 31, 2022
2 parents 11c103c + 7e4efb6 commit 2f94427
Show file tree
Hide file tree
Showing 21 changed files with 477 additions and 473 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Adapt to new simonaAPI snapshot [#95](https://github.com/ie3-institute/simona/issues/95)
- Update Sphinx to 4.5.0 as well as extensions [#214](https://github.com/ie3-institute/simona/issues/214)
- Improved code quality in and around DBFS algorithm [#265](https://github.com/ie3-institute/simona/issues/265)
- Adapt test to new PowerSystemUtils snapshot [#294](https://github.com/ie3-institute/simona/issues/294)
- Simplified ParticipantConfigUtil [#273](https://github.com/ie3-institute/simona/issues/273)

### Fixed
- Location of `vn_simona` test grid (was partially in Berlin and Dortmund) [#72](https://github.com/ie3-institute/simona/issues/72)
Expand All @@ -50,6 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed some unreachable code [#167](https://github.com/ie3-institute/simona/issues/167)
- Fix treatment of non-InitializeTrigger triggers in initialization within SimScheduler [#237](https://github.com/ie3-institute/simona/issues/237)
- Fix breaking SIMONA caused by introducing temperature dependant load profiles in PSDM [#255](https://github.com/ie3-institute/simona/issues/255)
- Respect for voltage angle in DBFS slack voltage exchange protocol [#69](https://github.com/ie3-institute/simona/issues/69)
- Adapted to changed time series interfaces in PSDM [#296](https://github.com/ie3-institute/simona/issues/296)

### Removed
- Remove workaround for tscfg tmp directory [#178](https://github.com/ie3-institute/simona/issues/178)
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id 'signing'
id 'maven-publish' // publish to a maven repo (local or mvn central, has to be defined)
id 'pmd' // code check, working on source code
id 'com.diffplug.spotless' version '6.7.2'// code format
id 'com.diffplug.spotless' version '6.9.0'// code format
id 'com.github.onslip.gradle-one-jar' version '1.0.6' // pack a self contained jar
id "com.github.ben-manes.versions" version '0.42.0'
id "de.undercouch.download" version "5.1.0" // downloads plugin
Expand All @@ -29,9 +29,9 @@ ext {
akkaVersion = '2.6.19'
jtsVersion = '1.19.0'
tscfgVersion = '0.9.998'
scapegoatVersion = '1.4.14'
scapegoatVersion = '1.4.15'

testContainerVersion = '0.40.8'
testContainerVersion = '0.40.9'

scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator // location of script plugins
}
Expand Down Expand Up @@ -147,7 +147,7 @@ dependencies {

/* Kafka */
implementation group: 'org.apache.kafka', name: 'kafka-clients', version: '3.2.0'
implementation 'io.confluent:kafka-streams-avro-serde:7.1.2'
implementation 'io.confluent:kafka-streams-avro-serde:7.2.1'
implementation "com.sksamuel.avro4s:avro4s-core_${scalaVersion}:4.1.0"

implementation 'org.apache.commons:commons-math3:3.6.1' // apache commons math3
Expand Down
13 changes: 2 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.

# Workaround to make spotless work with java 17 -
# see https://github.com/diffplug/spotless/tree/main/plugin-gradle#google-java-format and
# https://github.com/ie3-institute/simona/issues/59 for details
org.gradle.jvmargs=-Xmx4096m \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
org.gradle.jvmargs=-Xmx4096m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

com.github.maiflai.gradle-scalatest.mode = append
com.github.maiflai.gradle-scalatest.mode = append
49 changes: 30 additions & 19 deletions src/main/scala/edu/ie3/simona/agent/grid/DBFSAlgorithm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -433,21 +433,23 @@ trait DBFSAlgorithm extends PowerFlowSupport with GridResultsSupport {
)

val gridModel = gridAgentBaseData.gridEnv.gridModel
val powerFlowResult = newtonRaphsonPF(

val (operatingPoint, slackNodeVoltages) = composeOperatingPoint(
gridModel.gridComponents.nodes,
gridModel.gridComponents.transformers,
gridModel.gridComponents.transformers3w,
gridModel.nodeUuidToIndexMap,
gridAgentBaseData.receivedValueStore,
gridModel.mainRefSystem
)

newtonRaphsonPF(
gridModel,
gridAgentBaseData.powerFlowParams.maxIterations,
composeOperatingPoint(
gridModel.gridComponents.nodes,
gridModel.gridComponents.transformers,
gridModel.gridComponents.transformers3w,
gridModel.nodeUuidToIndexMap,
gridAgentBaseData.receivedValueStore,
gridModel.mainRefSystem
)
)(gridAgentBaseData.powerFlowParams.epsilon)

// if res is valid, ask our assets (if any) for updated power values based on the newly determined nodal voltages
powerFlowResult match {
operatingPoint,
slackNodeVoltages
)(gridAgentBaseData.powerFlowParams.epsilon) match {
// if res is valid, ask our assets (if any) for updated power values based on the newly determined nodal voltages
case validPowerFlowResult: ValidNewtonRaphsonPFResult =>
log.debug(
"{}",
Expand Down Expand Up @@ -579,16 +581,21 @@ trait DBFSAlgorithm extends PowerFlowSupport with GridResultsSupport {
s"$actorName Unable to get results from previous sweep ${gridAgentBaseData.currentSweepNo - 1}!"
)
)
newtonRaphsonPF(
gridModel,
gridAgentBaseData.powerFlowParams.maxIterations,

val (operatingPoint, slackNodeVoltages) =
composeOperatingPointWithUpdatedSlackVoltages(
receivedSlackValues,
previousSweepData.sweepData,
gridModel.gridComponents.transformers,
gridModel.gridComponents.transformers3w,
gridModel.mainRefSystem
)

newtonRaphsonPF(
gridModel,
gridAgentBaseData.powerFlowParams.maxIterations,
operatingPoint,
slackNodeVoltages
)(gridAgentBaseData.powerFlowParams.epsilon) match {
case validPowerFlowResult: ValidNewtonRaphsonPFResult =>
log.debug(
Expand Down Expand Up @@ -658,7 +665,10 @@ trait DBFSAlgorithm extends PowerFlowSupport with GridResultsSupport {

case failedNewtonRaphsonPFResult: FailedNewtonRaphsonPFResult =>
val powerFlowDoneData =
PowerFlowDoneData(gridAgentBaseData, failedNewtonRaphsonPFResult)
PowerFlowDoneData(
gridAgentBaseData,
failedNewtonRaphsonPFResult
)
log.warning(
"Power flow with updated slack voltage did finally not converge!"
)
Expand Down Expand Up @@ -705,7 +715,7 @@ trait DBFSAlgorithm extends PowerFlowSupport with GridResultsSupport {

/* This is the highest grid agent, therefore no data is received for the slack node. Suppress, that it is looked
* up in the empty store. */
val operationPoint = composeOperatingPoint(
val (operationPoint, slackNodeVoltages) = composeOperatingPoint(
gridModel.gridComponents.nodes,
gridModel.gridComponents.transformers,
gridModel.gridComponents.transformers3w,
Expand All @@ -729,7 +739,8 @@ trait DBFSAlgorithm extends PowerFlowSupport with GridResultsSupport {
newtonRaphsonPF(
gridModel,
gridAgentBaseData.powerFlowParams.maxIterations,
operationPoint
operationPoint,
slackNodeVoltages
)(gridAgentBaseData.powerFlowParams.epsilon) match {
case validPowerFlowResult: ValidNewtonRaphsonPFResult =>
log.debug(
Expand Down
20 changes: 15 additions & 5 deletions src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ class GridAgentController(
case input: FixedFeedInInput =>
buildFixedFeedIn(
input,
participantConfigUtil.getFixedFeedConfigOrDefault(input.getUuid),
participantConfigUtil.getOrDefault[FixedFeedInRuntimeConfig](
input.getUuid
),
environmentRefs.primaryServiceProxy,
simulationStartDate,
simulationEndDate,
Expand All @@ -232,7 +234,9 @@ class GridAgentController(
case input: LoadInput =>
buildLoad(
input,
participantConfigUtil.getLoadConfigOrDefault(input.getUuid),
participantConfigUtil.getOrDefault[LoadRuntimeConfig](
input.getUuid
),
environmentRefs.primaryServiceProxy,
simulationStartDate,
simulationEndDate,
Expand All @@ -243,7 +247,9 @@ class GridAgentController(
case input: PvInput =>
buildPV(
input,
participantConfigUtil.getPvConfigOrDefault(input.getUuid),
participantConfigUtil.getOrDefault[PvRuntimeConfig](
input.getUuid
),
environmentRefs.primaryServiceProxy,
environmentRefs.weather,
simulationStartDate,
Expand All @@ -255,7 +261,9 @@ class GridAgentController(
case input: WecInput =>
buildWec(
input,
participantConfigUtil.getWecConfigOrDefault(input.getUuid),
participantConfigUtil.getOrDefault[WecRuntimeConfig](
input.getUuid
),
environmentRefs.primaryServiceProxy,
environmentRefs.weather,
simulationStartDate,
Expand All @@ -267,7 +275,9 @@ class GridAgentController(
case input: EvcsInput =>
buildEvcs(
input,
participantConfigUtil.getEvcsConfigOrDefault(input.getUuid),
participantConfigUtil.getOrDefault[EvcsRuntimeConfig](
input.getUuid
),
environmentRefs.primaryServiceProxy,
environmentRefs.evDataService.getOrElse(
throw new GridAgentInitializationException(
Expand Down
Loading

0 comments on commit 2f94427

Please sign in to comment.