Skip to content

Commit

Permalink
Merge branch 'refs/heads/dev' into sp/#776-ext-sim-next-tick
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
sebastian-peter committed Aug 14, 2024
2 parents f74c24a + df66ad2 commit 99d94e1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Rewrote ThermalHouseTest from groovy to scala [#646](https://github.com/ie3-institute/simona/issues/646)
- Updated dependabot reviewers [#888](https://github.com/ie3-institute/simona/issues/888)
- Merged `HpModelTestData` with `HpTestData` to `HpInputTestData` [#872](https://github.com/ie3-institute/simona/issues/872)
- Harmonised both methods that check the inner temperature of thermal house against the boundaries [#880](https://github.com/ie3-institute/simona/issues/880)
- External simulation should provide information about next tick of MobSim [#776](https://github.com/ie3-institute/simona/issues/776)

### Fixed
Expand Down Expand Up @@ -156,6 +157,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed format of example grid `vn_simona` [#216](https://github.com/ie3-institute/simona/issues/216)
- Renamed ChpData to ChpRelevantData [#494](https://github.com/ie3-institute/simona/issues/494)
- Updated gradle to 8.2.1, cleaned up `build.gradle` and `Jenkinsfile` [#572](https://github.com/ie3-institute/simona/issues/572)
- Changed implementation of actor naming for unique name generation [#103](https://github.com/ie3-institute/simona/issues/103)

### Fixed
- Location of `vn_simona` test grid (was partially in Berlin and Dortmund) [#72](https://github.com/ie3-institute/simona/issues/72)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ext {
jtsVersion = '1.19.0'
confluentKafkaVersion = '7.4.0'
tscfgVersion = '1.0.0'
scapegoatVersion = '2.1.6'
scapegoatVersion = '3.0.0'

testContainerVersion = '0.41.4'

Expand Down
21 changes: 10 additions & 11 deletions src/main/scala/edu/ie3/simona/actor/SimonaActorNaming.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,28 @@ 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
import scala.util.Random

object SimonaActorNaming {

implicit class RichActorRefFactory(private val refFactory: ActorRefFactory)
extends AnyVal {

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

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

/** Constructs a uuid and cuts it down to 6 digits for convenience. Although
* this is dangerous as duplicates might be possible, it should be sufficient
* in our case as the uniqueness is only required in one actor system
/** Constructs an Id for convenience actor naming. Although this is dangerous
* as duplicates might be possible, it should be sufficient in our case as
* the uniqueness is only required in one actor system
*
* @return
* a shortened uuid string
* an Id string
*/
private def simonaActorUuid: String =
UUID.randomUUID().toString.substring(0, 5)
private def simonaActorId(actorId: String): String = {
val randomNumber = Random.nextInt(1000).toString
s"$actorId-$randomNumber"
}

/** Constructs an actor name based on the simona convention for actor names.
* The provided combination of class and id has to be unique for the whole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ class GridAgentController(
maybeControllingEm,
),
listener.map(_.toClassic),
)
),
evcsInput.getId,
)
.toTyped

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ final case class ThermalHouse(
* true, if inner temperature is too high
*/
def isInnerTemperatureTooHigh(
innerTemperature: Temperature
innerTemperature: Temperature,
boundaryTemperature: Temperature = upperBoundaryTemperature,
): Boolean =
innerTemperature > Kelvin(
upperBoundaryTemperature.toKelvinScale - temperatureTolerance.toKelvinScale
boundaryTemperature.toKelvinScale - temperatureTolerance.toKelvinScale
)

/** Check if inner temperature is lower than preferred minimum temperature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class SimonaStandaloneSetup(
simulationStart,
),
simulationStart,
)
),
"primaryServiceProxyAgent",
)

scheduler ! ScheduleActivation(primaryServiceProxy.toTyped, INIT_SIM_TICK)
Expand All @@ -178,7 +179,8 @@ class SimonaStandaloneSetup(
.toZonedDateTime(simonaConfig.simona.time.startDateTime),
TimeUtil.withDefaults
.toZonedDateTime(simonaConfig.simona.time.endDateTime),
)
),
"weatherAgent",
)
weatherService ! SimonaService.Create(
InitWeatherServiceStateData(
Expand Down

0 comments on commit 99d94e1

Please sign in to comment.