From b368e4844b87157ddc64e72b794c37aff6ab7563 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 07:00:08 +0000 Subject: [PATCH 1/7] Bump myst-parser from 3.0.1 to 4.0.0 in /docs/readthedocs (#884) --- docs/readthedocs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/readthedocs/requirements.txt b/docs/readthedocs/requirements.txt index ddb172e349..34b2f0762a 100644 --- a/docs/readthedocs/requirements.txt +++ b/docs/readthedocs/requirements.txt @@ -1,7 +1,7 @@ Sphinx==7.3.7 sphinx-rtd-theme==2.0.0 sphinxcontrib-plantuml==0.30 -myst-parser==3.0.1 +myst-parser==4.0.0 markdown-it-py==3.0.0 sphinx-hoverxref==1.4.0 sphinxcontrib-bibtex==2.6.2 From 218a16cea75af1a7ea49725e933923440d6ac7f3 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 7 Aug 2024 14:33:46 +0200 Subject: [PATCH 2/7] Add gradle run capability --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index ce7622d024..4cb0924764 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ plugins { id "com.github.maiflai.scalatest" version "0.32" // run scalatest without specific spec task id 'org.hidetake.ssh' version '2.11.2' id 'net.thauvin.erik.gradle.semver' version '1.0.4' // semantic versioning + id "application" } ext { @@ -163,6 +164,11 @@ tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } +// Run with ./gradlew run --args='--config /path/to/simona.conf' +application { + mainClassName = 'edu.ie3.simona.main.RunSimonaStandalone' +} + jar { manifest { attributes( From fe18b421b53a612df0a6c3c40306054d7ab29cec Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Wed, 7 Aug 2024 16:22:54 +0200 Subject: [PATCH 3/7] Returning dummy prices on request Signed-off-by: Sebastian Peter --- CHANGELOG.md | 1 + .../simona/service/ev/ExtEvDataService.scala | 23 ++++++- .../service/ev/ExtEvDataServiceSpec.scala | 62 ++++++++++++++++++- 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 468de1d410..47b052f53b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed result output for thermal houses and cylindrical storages [#844](https://github.com/ie3-institute/simona/issues/844) - Fixed FixedFeedModelSpec [#861](https://github.com/ie3-institute/simona/issues/861) - Fixing duration calculation in result events [#801](https://github.com/ie3-institute/simona/issues/801) +- Handle MobSim requests for current prices [#892](https://github.com/ie3-institute/simona/issues/892) ## [3.0.0] - 2023-08-07 diff --git a/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala b/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala index c827cb52fb..f6b8dc9884 100644 --- a/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala +++ b/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala @@ -180,6 +180,8 @@ class ExtEvDataService(override val scheduler: ActorRef) "ExtEvDataService was triggered without ExtEvMessage available" ) ) match { + case _: RequestCurrentPrices => + requestCurrentPrices() case _: RequestEvcsFreeLots => requestFreeLots(tick) case departingEvsRequest: RequestDepartingEvs => @@ -192,6 +194,25 @@ class ExtEvDataService(override val scheduler: ActorRef) } } + private def requestCurrentPrices()(implicit + serviceStateData: ExtEvStateData + ): (ExtEvStateData, Option[Long]) = { + // currently not supported, return dummy + val prices = serviceStateData.uuidToActorRef.map { case (evcs, _) => + evcs -> double2Double(0d) + } + serviceStateData.extEvData.queueExtResponseMsg( + new ProvideCurrentPrices(prices.asJava) + ) + + ( + serviceStateData.copy( + extEvMessage = None + ), + None, + ) + } + private def requestFreeLots(tick: Long)(implicit serviceStateData: ExtEvStateData ): (ExtEvStateData, Option[Long]) = { @@ -351,7 +372,7 @@ class ExtEvDataService(override val scheduler: ActorRef) freeLotsCount > 0 } .map { case (evcs, freeLotsCount) => - evcs -> Integer.valueOf(freeLotsCount) + evcs -> int2Integer(freeLotsCount) } serviceStateData.extEvData.queueExtResponseMsg( diff --git a/src/test/scala/edu/ie3/simona/service/ev/ExtEvDataServiceSpec.scala b/src/test/scala/edu/ie3/simona/service/ev/ExtEvDataServiceSpec.scala index 5eed45eb46..62c062c86e 100644 --- a/src/test/scala/edu/ie3/simona/service/ev/ExtEvDataServiceSpec.scala +++ b/src/test/scala/edu/ie3/simona/service/ev/ExtEvDataServiceSpec.scala @@ -263,10 +263,70 @@ class ExtEvDataServiceSpec extData.receiveTriggerQueue.size() shouldBe 1 // only evcs 1 should be included, the other one is full extData.receiveTriggerQueue.take() shouldBe new ProvideEvcsFreeLots( - Map(evcs1UUID -> Integer.valueOf(2)).asJava + Map(evcs1UUID -> int2Integer(2)).asJava ) } + "handle price requests correctly by returning dummy values" in { + val evService = TestActorRef(new ExtEvDataService(scheduler.ref)) + + val extData = extEvData(evService) + + val key = + ScheduleLock.singleKey(TSpawner, scheduler.ref.toTyped, INIT_SIM_TICK) + scheduler.expectMsgType[ScheduleActivation] // lock activation scheduled + + scheduler.send( + evService, + SimonaService.Create(InitExtEvData(extData), key), + ) + scheduler.expectMsgType[ScheduleActivation] + + scheduler.send(evService, Activation(INIT_SIM_TICK)) + scheduler.expectMsg(Completion(evService.toTyped)) + + val evcs1 = TestProbe("evcs1") + val evcs2 = TestProbe("evcs2") + + evcs1.send(evService, RegisterForEvDataMessage(evcs1UUID)) + evcs1.expectMsgType[RegistrationSuccessfulMessage] + + evcs2.send(evService, RegisterForEvDataMessage(evcs2UUID)) + evcs2.expectMsgType[RegistrationSuccessfulMessage] + + extData.sendExtMsg(new RequestCurrentPrices()) + + // ev service should receive request at this moment + // scheduler should receive schedule msg + extSimAdapter.expectMsg(new ScheduleDataServiceMessage(evService)) + + val tick = 0L + + // we trigger ev service + scheduler.send(evService, Activation(tick)) + + evcs1.expectNoMessage() + evcs2.expectNoMessage() + + // ev service should recognize that all evcs that are expected are returned, + // thus should send ProvideEvcsFreeLots + awaitCond( + !extData.receiveTriggerQueue.isEmpty, + max = 3.seconds, + message = "No message received", + ) + extData.receiveTriggerQueue.size() shouldBe 1 + // only evcs 1 should be included, the other one is full + extData.receiveTriggerQueue.take() shouldBe new ProvideCurrentPrices( + Map( + evcs1UUID -> double2Double(0d), + evcs2UUID -> double2Double(0d), + ).asJava + ) + + scheduler.expectMsg(Completion(evService.toTyped)) + } + "return free lots requests right away if there are no evcs registered" in { val evService = TestActorRef(new ExtEvDataService(scheduler.ref)) From 0ef185226b6a912d3a8a7082b6714bf7cd5599b2 Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Wed, 7 Aug 2024 16:56:51 +0200 Subject: [PATCH 4/7] Re-using dummy value Signed-off-by: Sebastian Peter --- .../scala/edu/ie3/simona/service/ev/ExtEvDataService.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala b/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala index f6b8dc9884..052a19b479 100644 --- a/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala +++ b/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala @@ -198,8 +198,9 @@ class ExtEvDataService(override val scheduler: ActorRef) serviceStateData: ExtEvStateData ): (ExtEvStateData, Option[Long]) = { // currently not supported, return dummy + val dummyPrice = double2Double(0d) val prices = serviceStateData.uuidToActorRef.map { case (evcs, _) => - evcs -> double2Double(0d) + evcs -> dummyPrice } serviceStateData.extEvData.queueExtResponseMsg( new ProvideCurrentPrices(prices.asJava) From f44461e3299f678d8a849b27373fac02c7a97d6f Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Thu, 8 Aug 2024 11:23:32 +0200 Subject: [PATCH 5/7] Re-using manifest main class definition Signed-off-by: Sebastian Peter --- build.gradle | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index d540a0c176..3824cacff2 100644 --- a/build.gradle +++ b/build.gradle @@ -159,10 +159,6 @@ tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } -// Run with ./gradlew run --args='--config /path/to/simona.conf' -application { - mainClassName = 'edu.ie3.simona.main.RunSimonaStandalone' -} jar { manifest { @@ -172,6 +168,11 @@ jar { } } +// Run with ./gradlew run --args='--config /path/to/simona.conf' +application { + mainClassName = jar.manifest.attributes.get('Main-Class') +} + ////////////////////////////////////////////////////////////////////// // Build pekko'able fat jar using the gradle shadow plugin // see http://www.sureshpw.com/2015/10/building-akka-bundle-with-all.html From 2d806b3d9b363f18241875c7228e610ff089a571 Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Thu, 8 Aug 2024 11:24:43 +0200 Subject: [PATCH 6/7] Adding to changelog Signed-off-by: Sebastian Peter --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47b052f53b..825935b29e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Implementation of StorageAgent [#309](https://github.com/ie3-institute/simona/issues/309) - Enhanced Newton-Raphson-PowerFlow failures with more information [#815](https://github.com/ie3-institute/simona/issues/815) - Update RTD references and bibliography [#868](https://github.com/ie3-institute/simona/issues/868) +- Add gradle application plugin for command line execution with gradle run [#890](https://github.com/ie3-institute/simona/issues/890) ### Changed - Adapted to changed data source in PSDM [#435](https://github.com/ie3-institute/simona/issues/435) From 380df9fbe97a157f34623c7b2754db64a4ecbe38 Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Thu, 8 Aug 2024 11:27:05 +0200 Subject: [PATCH 7/7] fmt Signed-off-by: Sebastian Peter --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3824cacff2..dac93ee8d2 100644 --- a/build.gradle +++ b/build.gradle @@ -159,7 +159,6 @@ tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } - jar { manifest { attributes(