Skip to content

Commit

Permalink
Merge branch 'refs/heads/dev' into df/#930-refactor-handleInfeed
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
  • Loading branch information
danielfeismann committed Aug 29, 2024
2 parents 64a67ec + b870fe7 commit cb34618
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 274 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated AUTHORS.md [#904](https://github.com/ie3-institute/simona/issues/904)
- Updated `Gradle` to version V8.10 [#829](https://github.com/ie3-institute/simona/issues/829)
- Updated AUTHORS.md [#905](https://github.com/ie3-institute/simona/issues/905)
- Rewrote BMModelTest from groovy to scala [#646](https://github.com/ie3-institute/simona/issues/646)
- Prepare ThermalStorageTestData for Storage without storageVolumeLvlMin [#894](https://github.com/ie3-institute/simona/issues/894)
- Refactoring of `ThermalGrid.energyGrid` to distinguish between demand of house and storage [#928](https://github.com/ie3-institute/simona/issues/928)

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ext {
pekkoVersion = '1.0.3'
jtsVersion = '1.19.0'
confluentKafkaVersion = '7.4.0'
tscfgVersion = '1.0.0'
tscfgVersion = '1.1.3'
scapegoatVersion = '3.0.0'

testContainerVersion = '0.41.4'
Expand Down Expand Up @@ -103,7 +103,7 @@ dependencies {
/* 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.12.0' // mocking framework
testImplementation 'org.mockito:mockito-core:5.13.0' // mocking framework
testImplementation "org.scalatest:scalatest_${scalaVersion}:3.2.19"
testRuntimeOnly 'com.vladsch.flexmark:flexmark-all:0.64.8' //scalatest html output
testImplementation group: 'org.pegdown', name: 'pegdown', version: '1.6.0'
Expand Down
18 changes: 9 additions & 9 deletions src/main/scala/edu/ie3/simona/model/participant/BMModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final case class BMModel(

/** Saves power output of last cycle. Needed for load gradient
*/
private var _lastPower: Option[Power] = None
var _lastPower: Option[Power] = None

override def calculatePower(
tick: Long,
Expand All @@ -73,7 +73,7 @@ final case class BMModel(
* @return
* Active power
*/
override protected def calculateActivePower(
override def calculateActivePower(
modelState: ConstantState.type,
data: BMCalcRelevantData,
): Power = {
Expand All @@ -100,7 +100,7 @@ final case class BMModel(
* @return
* factor k1
*/
private def calculateK1(time: ZonedDateTime): Double = {
def calculateK1(time: ZonedDateTime): Double = {
val weekendCorr = Vector(0.98, 0.985, 0.982, 0.982, 0.97, 0.96, 0.95, 0.93,
0.925, 0.95, 0.98, 1.01, 1.018, 1.01, 1.01, 0.995, 1, 0.995, 0.99, 0.985,
0.99, 0.98, 0.975, 0.99)
Expand All @@ -120,7 +120,7 @@ final case class BMModel(
* @return
* factor k2
*/
private def calculateK2(time: ZonedDateTime): Double = {
def calculateK2(time: ZonedDateTime): Double = {
time.getDayOfYear match {
case x if x < 150 || x > 243 =>
1.03 // correction factor in heating season
Expand All @@ -138,7 +138,7 @@ final case class BMModel(
* @return
* heat demand in Megawatt
*/
private def calculatePTh(
def calculatePTh(
temp: Temperature,
k1: Double,
k2: Double,
Expand All @@ -158,7 +158,7 @@ final case class BMModel(
* @return
* usage
*/
private def calculateUsage(pTh: Power): Double = {
def calculateUsage(pTh: Power): Double = {
// if demand exceeds capacity -> activate peak load boiler (no effect on electrical output)
val maxHeat = Megawatts(43.14)
val usageUnchecked = pTh / maxHeat
Expand All @@ -173,7 +173,7 @@ final case class BMModel(
* @return
* efficiency
*/
private def calculateEff(usage: Double): Double =
def calculateEff(usage: Double): Double =
min(0.18 * pow(usage, 3) - 0.595 * pow(usage, 2) + 0.692 * usage + 0.724, 1)

/** Calculates electrical output from usage and efficiency
Expand All @@ -184,7 +184,7 @@ final case class BMModel(
* @return
* electrical output as Power
*/
private def calculateElOutput(
def calculateElOutput(
usage: Double,
eff: Double,
): Power = {
Expand All @@ -206,7 +206,7 @@ final case class BMModel(
* @return
* electrical output after load gradient has been applied
*/
private def applyLoadGradient(
def applyLoadGradient(
pEl: Power
): Power = {
_lastPower match {
Expand Down
16 changes: 8 additions & 8 deletions src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ final case class ThermalGrid(
* @param state
* Currently applicable state
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* Actual ambient temperature
* Current ambient temperature
* @param isRunning
* determines whether the heat pump is running or not
* @param qDot
Expand Down Expand Up @@ -201,9 +201,9 @@ final case class ThermalGrid(
* @param tick
* Current tick
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* Actual ambient temperature
* Current ambient temperature
* @param state
* Current state of the houses
* @param isRunning
Expand Down Expand Up @@ -504,9 +504,9 @@ final case class ThermalGrid(
* @param tick
* Current tick
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* Actual ambient temperature
* Current ambient temperature
* @param state
* Current state of the houses
* @param qDot
Expand Down Expand Up @@ -580,9 +580,9 @@ final case class ThermalGrid(
* @param formerStorageState
* Previous thermal storage state before a first update was performed
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* Actual ambient temperature
* Current ambient temperature
* @param qDot
* Thermal influx
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ final case class ThermalHouse(
* @param state
* Currently applicable state
* @param lastAmbientTemperature
* Ambient temperature until this tick
* Ambient temperature valid up until (not including) the current tick
* @param ambientTemperature
* Actual ambient temperature
* Current ambient temperature
* @param qDot
* New thermal influx
* @return
Expand Down
Loading

0 comments on commit cb34618

Please sign in to comment.