Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into ck/#22-dbfsMultipleCon…
Browse files Browse the repository at this point in the history
…nections

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
ckittl committed Mar 8, 2022
2 parents 73dcc5a + 1d5dcb7 commit b97ba5e
Show file tree
Hide file tree
Showing 33 changed files with 158 additions and 217 deletions.
13 changes: 12 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ updates:
- johanneshiry
- t-ober
- sensarmad
- sebastian-peter
- danielfeismann
ignore:
- dependency-name: org.spockframework:spock-core
versions:
- 2.1-groovy-3.0-SNAPSHOT
- 2.1-groovy-2.5-SNAPSHOT
- 2.1-groovy-3.0-SNAPSHOT
- 2.2-groovy-4.0-SNAPSHOT
- 2.2-groovy-2.5-SNAPSHOT
- 2.2-groovy-3.0-SNAPSHOT
- 2.2-M1-groovy-2.5
- 2.2-M1-groovy-3.0
- 2.2-M1-groovy-4.0
- 2.2-M2-groovy-2.5
- 2.2-M2-groovy-3.0
- 2.2-M2-groovy-4.0
- dependency-name: org.scalatest:scalatest_2.13
versions:
- 3.3.0-SNAP+
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ output
deploy.properties

# pv model it data
!src/test/resources/**/it-data
!src/test/resources/**/it

# avoid ignoring test jars
!src/test/resources/**/*.jar

# Ignore Gradle build output directory
build
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Improving code readability in EvcsAgent by moving FreeLotsRequest to separate methods
- Re-organizing test resources into their respective packages [#105](https://github.com/ie3-institute/simona/issues/105)
- BREAKING: Using snapshot version of PSDM
- Simplified PrimaryServiceProxy due to changes in PSDM [#120](https://github.com/ie3-institute/simona/issues/120)

### Fixed
- Location of `vn_simona` test grid (was partially in Berlin and Dortmund)
- Fix power exchange between grids
- Let `ParticipantAgent` die after failed registration with secondary services (prevents stuck simulation) [#76](https://github.com/ie3-institute/simona/issues/76)
- Fix power exchange between grids [#22](https://github.com/ie3-institute/simona/issues/22)
- Consolidate request replies for different sub grid gates in one message
- Await and send responses for distinct pairs of sender reference and target node

Expand Down
14 changes: 7 additions & 7 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.2.1'// code format
id 'com.diffplug.spotless' version '6.3.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.0.1" // downloads plugin
Expand Down Expand Up @@ -74,7 +74,7 @@ dependencies {
/* Exclude our own nested dependencies */
exclude group: 'com.github.ie3-institute'
}
implementation('com.github.ie3-institute:PowerSystemDataModel:2.1.0') {
implementation('com.github.ie3-institute:PowerSystemDataModel:3.0-SNAPSHOT') {
exclude group: 'org.apache.logging.log4j'
exclude group: 'org.slf4j'
/* Exclude our own nested dependencies */
Expand All @@ -96,14 +96,14 @@ dependencies {

/* logging */
implementation "com.typesafe.scala-logging:scala-logging_${scalaVersion}:3.9.4" // akka scala logging
implementation "ch.qos.logback:logback-classic:1.2.10"
implementation "ch.qos.logback:logback-classic:1.2.11"

/* testing */
testImplementation 'org.spockframework:spock-core:2.1-M2-groovy-3.0'
testImplementation 'org.scalatestplus:mockito-3-4_2.13:3.2.10.0'
implementation 'org.mockito:mockito-core:4.3.1' // mocking framework
testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.11"
testRuntimeClasspath 'com.vladsch.flexmark:flexmark-all:0.62.2'
testRuntimeClasspath 'com.vladsch.flexmark:flexmark-all:0.64.0'
testImplementation group: 'org.pegdown', name: 'pegdown', version: '1.6.0'
testImplementation "com.typesafe.akka:akka-testkit_${scalaVersion}:${akkaVersion}" // akka testkit

Expand Down Expand Up @@ -136,13 +136,13 @@ dependencies {
scalaCompilerPlugin "com.sksamuel.scapegoat:scalac-scapegoat-plugin_${scalaBinaryVersion}:${scapegoatVersion}"

implementation 'org.apache.commons:commons-math3:3.6.1' // apache commons math3
implementation 'org.apache.poi:poi-ooxml:5.2.0' // used for FilenameUtils
implementation 'org.apache.poi:poi-ooxml:5.2.1' // used for FilenameUtils
implementation 'javax.measure:unit-api:2.1.3'
implementation 'tech.units:indriya:2.1.2' // quantities
implementation 'tech.units:indriya:2.1.3' // quantities
implementation 'org.apache.commons:commons-csv:1.9.0'
implementation 'org.scalanlp:breeze_2.13:1.3' // scientific calculations (http://www.scalanlp.org/)
implementation 'de.lmu.ifi.dbs.elki:elki:0.7.5' // Statistics (for random load model)
implementation 'com.google.guava:guava:31.0.1-jre' // Building threads
implementation 'com.google.guava:guava:31.1-jre' // Building threads
implementation 'org.jgrapht:jgrapht-core:1.5.1'
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions docs/readthedocs/usersguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ To run and customize the project you need a Java Development Kit (JDK) installat
Installation
============

You can find and download the source code of the latest stable SIMONA version `here <https://git.ie3.e-technik.tu-dortmund.de/SIMONACrew/SIMONA>`_. Go ahead and clone the repository using git:
You can find and download the source code of the latest stable SIMONA version `here <https://github.com/ie3-institute/simona>`_. Go ahead and clone the repository using git:

.. code-block:: none
$ git clone https://git.ie3.e-technik.tu-dortmund.de/SIMONACrew/SIMONA.git
$ git clone https://github.com/ie3-institute/simona.git
Running a Standalone Simulation
Expand Down Expand Up @@ -170,7 +170,7 @@ SIMONA is capable of running an external sub-simulation by integration within th
The information flow between SIMONA and the external simulation is partitioned into a control stream (see ``edu.ie3.simona.api.ExtSimAdapter``) and a number of optional data streams.
Currently, only a data stream transporting electric vehicle movement information is implemented (see ``edu.ie3.simona.service.ev.ExtEvDataService``).

An external simulation has to depend on `SimonaAPI <https://git.ie3.e-technik.tu-dortmund.de/SIMONACrew/SimonaAPI>`_ and make use of some of its interfaces (see below).
An external simulation has to depend on `SimonaAPI <https://github.com/ie3-institute/simonaAPI>`_ and make use of some of its interfaces (see below).
In order to run an external simulation, several requirements have to be fulfilled and a bunch of preparation steps have to be followed.

.. note::
Expand Down Expand Up @@ -200,3 +200,4 @@ These steps have to be performed each time updates to the external simulation ne
- Copy the resulting *jar* (usually placed inside <external project>/build/libs) to SIMONA/inputData/ext_sim.

Now, when a simulation with SIMONA is started (see `above <#running-a-standalone-simulation>`_), the external simulation is triggered at each tick that it requested.

2 changes: 1 addition & 1 deletion input/samples/vn_simona/fullGrid/pv_input.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"uuid","albedo","azimuth","cos_phi_rated","eta_conv","height","id","k_g","k_t","market_reaction","node","operates_from","operates_until","operator","q_characteristics","s_rated"
"uuid","albedo","azimuth","cos_phi_rated","eta_conv","elevation_angle","id","k_g","k_t","market_reaction","node","operates_from","operates_until","operator","q_characteristics","s_rated"
5b38af42-1ee4-4a41-b666-ea141187df37,0.20000000298023224,-11.463644027709961,0.8999999761581421,96.0,33.62879943847656,NS_NET146_F2_(3)_PV,0.8999999761581421,1.0,false,0170837a-1876-45f9-a613-666f9991964d,,,,cosPhiFixed:{(0.00,0.90)},10.0
e447506e-3d43-4bce-8aab-a7ca8b7fbc45,0.20000000298023224,3.8914573192596436,0.8999999761581421,98.0,42.77021408081055,NS_NET146_F4_(9)_PV,0.8999999761581421,1.0,false,9b889b73-c108-4b38-b6eb-3377841e0c83,,,,cosPhiFixed:{(0.00,0.90)},10.0
6cac0624-6336-4418-bcf0-990abcdb824b,0.20000000298023224,-8.097375869750977,0.8999999761581421,98.0,44.90728759765625,NS_NET146_F4_(16)_PV,0.8999999761581421,1.0,false,9f7599de-c488-46c5-b053-1279a511f7b9,,,,cosPhiFixed:{(0.00,0.90)},30.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package edu.ie3.simona.agent.participant

import akka.actor.{ActorRef, FSM}
import akka.actor.{ActorRef, FSM, PoisonPill}
import akka.event.LoggingAdapter
import akka.util
import akka.util.Timeout
Expand Down Expand Up @@ -452,6 +452,7 @@ protected trait ParticipantAgentFundamentals[
)
}
case RegistrationResponseMessage.RegistrationFailedMessage =>
self ! PoisonPill
throw new ActorNotRegisteredException(
s"Registration of actor $actorName for ${sender()} failed."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ case object PVModel {
inputModel.getAlbedo,
inputModel.getEtaConv,
inputModel.getAzimuth,
inputModel.getHeight
inputModel.getElevationAngle
)

model.enable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@
package edu.ie3.simona.service.primary

import akka.actor.{Actor, ActorRef, PoisonPill, Props}
import edu.ie3.datamodel.io.connectors.CsvFileConnector.CsvIndividualTimeSeriesMetaInformation
import edu.ie3.datamodel.io.csv.timeseries.ColumnScheme
import edu.ie3.datamodel.io.csv.CsvIndividualTimeSeriesMetaInformation
import edu.ie3.datamodel.io.naming.FileNamingStrategy
import edu.ie3.datamodel.io.naming.timeseries.ColumnScheme
import edu.ie3.datamodel.io.source.TimeSeriesMappingSource
import edu.ie3.datamodel.io.source.csv.CsvTimeSeriesMappingSource
import edu.ie3.datamodel.models.value.{
HeatAndPValue,
HeatAndSValue,
PValue,
SValue,
Value
}
import edu.ie3.datamodel.models.value.Value
import edu.ie3.simona.config.SimonaConfig
import edu.ie3.simona.config.SimonaConfig.Simona.Input.Primary.CsvParams
import edu.ie3.simona.config.SimonaConfig.Simona.Input.{
Expand All @@ -34,23 +28,23 @@ import edu.ie3.simona.ontology.messages.SchedulerMessage.{
ScheduleTriggerMessage,
TriggerWithIdMessage
}
import edu.ie3.simona.ontology.messages.services.ServiceMessage.RegistrationResponseMessage.RegistrationFailedMessage
import edu.ie3.simona.ontology.messages.services.ServiceMessage.{
PrimaryServiceRegistrationMessage,
WorkerRegistrationMessage
}
import edu.ie3.simona.ontology.messages.services.ServiceMessage.RegistrationResponseMessage.RegistrationFailedMessage
import edu.ie3.simona.ontology.trigger.Trigger.InitializeServiceTrigger
import edu.ie3.simona.service.ServiceStateData
import edu.ie3.simona.service.ServiceStateData.InitializeServiceStateData
import edu.ie3.simona.service.primary.PrimaryServiceWorker.{
CsvInitPrimaryServiceStateData,
InitPrimaryServiceStateData
}
import edu.ie3.simona.service.primary.PrimaryServiceProxy.{
InitPrimaryServiceProxyStateData,
PrimaryServiceStateData,
SourceRef
}
import edu.ie3.simona.service.primary.PrimaryServiceWorker.{
CsvInitPrimaryServiceStateData,
InitPrimaryServiceStateData
}

import java.text.SimpleDateFormat
import java.time.ZonedDateTime
Expand Down Expand Up @@ -154,7 +148,7 @@ case class PrimaryServiceProxy(
.distinct
.flatMap { timeSeriesUuid =>
mappingSource
.getTimeSeriesMetaInformation(timeSeriesUuid)
.timeSeriesMetaInformation(timeSeriesUuid)
.toScala match {
case Some(metaInformation) =>
val columnScheme = metaInformation.getColumnScheme
Expand Down Expand Up @@ -245,7 +239,7 @@ case class PrimaryServiceProxy(
* @param stateData
* Current state data of the actor
*/
private[primary] def handleCoveredModel(
protected def handleCoveredModel(
modelUuid: UUID,
timeSeriesUuid: UUID,
stateData: PrimaryServiceStateData,
Expand Down Expand Up @@ -305,41 +299,31 @@ case class PrimaryServiceProxy(
* @return
* The [[ActorRef]] to the worker
*/
private[primary] def initializeWorker(
protected def initializeWorker(
columnScheme: ColumnScheme,
timeSeriesUuid: UUID,
simulationStart: ZonedDateTime,
primaryConfig: PrimaryConfig,
mappingSource: TimeSeriesMappingSource
): Try[ActorRef] =
(
columnSchemeToActor(
columnScheme,
timeSeriesUuid.toString,
simulationStart
),
toInitData(
primaryConfig,
mappingSource,
timeSeriesUuid,
simulationStart
)
): Try[ActorRef] = {
val workerRef = classToWorkerRef(
columnScheme.getValueClass,
timeSeriesUuid.toString,
simulationStart
)
toInitData(
primaryConfig,
mappingSource,
timeSeriesUuid,
simulationStart
) match {
case (Success(workerRef), Success(initData)) =>
/* Puh... Everything went through... */
case Success(initData) =>
scheduler ! ScheduleTriggerMessage(
InitializeServiceTrigger(initData),
workerRef
)
Success(workerRef)
case (Failure(cause), _) =>
Failure(
new InitializationException(
"Unable to establish a typed worker for primary data provision.",
cause
)
)
case (Success(workerRef), Failure(cause)) =>
case Failure(cause) =>
workerRef ! PoisonPill
Failure(
new InitializationException(
Expand All @@ -348,55 +332,7 @@ case class PrimaryServiceProxy(
)
)
}

/** Build a typed actor based on the foreseen class of value to distribute
*
* @param columnScheme
* Column scheme of foreseen primary data
* @param timeSeriesUuid
* uuid of the time series the actor processes
* @param simulationStart
* Wall clock time of first instant in simulation
* @return
* A trial on an [[ActorRef]] for the worker
*/
private[primary] def columnSchemeToActor(
columnScheme: ColumnScheme,
timeSeriesUuid: String,
simulationStart: ZonedDateTime
): Try[ActorRef] =
columnScheme match {
case ColumnScheme.ACTIVE_POWER =>
Success(
classToWorkerRef(classOf[PValue], timeSeriesUuid, simulationStart)
)
case ColumnScheme.APPARENT_POWER =>
Success(
classToWorkerRef(classOf[SValue], timeSeriesUuid, simulationStart)
)
case ColumnScheme.ACTIVE_POWER_AND_HEAT_DEMAND =>
Success(
classToWorkerRef(
classOf[HeatAndPValue],
timeSeriesUuid,
simulationStart
)
)
case ColumnScheme.APPARENT_POWER_AND_HEAT_DEMAND =>
Success(
classToWorkerRef(
classOf[HeatAndSValue],
timeSeriesUuid,
simulationStart
)
)
case unsupported =>
Failure(
new InitializationException(
s"Cannot build a primary source for unsupported column scheme '$unsupported'."
)
)
}
}

/** Build a primary source worker and type it to the foreseen value class to
* come
Expand All @@ -412,7 +348,7 @@ case class PrimaryServiceProxy(
* @return
* The [[ActorRef]] to the spun off actor
*/
private def classToWorkerRef[V <: Value](
protected def classToWorkerRef[V <: Value](
valueClass: Class[V],
timeSeriesUuid: String,
simulationStart: ZonedDateTime
Expand Down Expand Up @@ -450,7 +386,7 @@ case class PrimaryServiceProxy(
None
) =>
/* The mapping and actual data sources are from csv. At first, get the file name of the file to read. */
Try(mappingSource.getTimeSeriesMetaInformation(timeSeriesUuid).get)
Try(mappingSource.timeSeriesMetaInformation(timeSeriesUuid).get)
.flatMap {
/* Time series meta information could be successfully obtained */
case csvMetaData: CsvIndividualTimeSeriesMetaInformation =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
package edu.ie3.simona.service.primary

import akka.actor.{ActorRef, Props}
import edu.ie3.datamodel.io.csv.timeseries.ColumnScheme
import edu.ie3.datamodel.io.factory.timeseries.TimeBasedSimpleValueFactory
import edu.ie3.datamodel.io.naming.FileNamingStrategy
import edu.ie3.datamodel.io.naming.timeseries.ColumnScheme
import edu.ie3.datamodel.io.source.TimeSeriesSource
import edu.ie3.datamodel.io.source.csv.CsvTimeSeriesSource
import edu.ie3.datamodel.models.value.Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ object WeatherSource {
*/
object WeatherScheme extends ParsableEnumeration {
val ICON: Value = Value("icon")
val PSDM: Value = Value("psdm")
val COSMO: Value = Value("cosmo")
}

}
Loading

0 comments on commit b97ba5e

Please sign in to comment.