Skip to content

Commit

Permalink
Merge pull request #832 from ie3-institute/pp/#646-FixedFeedModelSpec…
Browse files Browse the repository at this point in the history
….scala-convert-groovy-tests-to-scalatest

FixedfeedModelSpec-convert-groovy-tests-to-scalatest
  • Loading branch information
danielfeismann authored Jul 25, 2024
2 parents 20f5c23 + b01f6d8 commit b7d3a96
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 80 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactor `WeatherSource` and `WeatherSourceWrapper` [#180](https://github.com/ie3-institute/simona/issues/180)
- Remove unnecessary dependency `pekko-connectors-csv` [#857](https://github.com/ie3-institute/simona/issues/857)
- Rewrote RefSystemTest from groovy to scala [#646](https://github.com/ie3-institute/simona/issues/646)
- Rewrote FixedFeedModelTest from groovy to scala [#646](https://github.com/ie3-institute/simona/issues/646)

### Fixed
- Removed a repeated line in the documentation of vn_simona config [#658](https://github.com/ie3-institute/simona/issues/658)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final case class FixedFeedInModel(
* @return
* Active power
*/
override protected def calculateActivePower(
override def calculateActivePower(
modelState: ConstantState.type,
data: FixedRelevantData.type = FixedRelevantData,
): Power =
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* © 2024. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/

package edu.ie3.simona.model.participant

import edu.ie3.simona.model.participant.control.QControl
import edu.ie3.simona.test.common.UnitSpec
import edu.ie3.simona.test.common.input.FixedFeedInputTestData
import edu.ie3.util.quantities.PowerSystemUnits
import edu.ie3.util.scala.quantities.Sq
import org.scalatest.prop.TableDrivenPropertyChecks
import squants.energy.{Kilowatts, Power, Watts}

class FixedFeedModelSpec
extends UnitSpec
with FixedFeedInputTestData
with TableDrivenPropertyChecks {
implicit val tolerance: Power = Watts(1d)
"Having a fixed feed model" when {

"The fixed feed model" should {
"return approximately correct power calculations" in {
val expectedPower = Kilowatts(
fixedFeedInput
.getsRated()
.to(PowerSystemUnits.KILOWATT)
.getValue
.doubleValue() * -1 * fixedFeedInput.getCosPhiRated
)

val actualModel = new FixedFeedInModel(
fixedFeedInput.getUuid,
fixedFeedInput.getId,
defaultOperationInterval,
QControl.apply(fixedFeedInput.getqCharacteristics()),
Kilowatts(
fixedFeedInput
.getsRated()
.to(PowerSystemUnits.KILOWATT)
.getValue
.doubleValue()
),
fixedFeedInput.getCosPhiRated,
)

actualModel.calculateActivePower(
ModelState.ConstantState,
CalcRelevantData.FixedRelevantData,
) =~ expectedPower
}
}

}
}

0 comments on commit b7d3a96

Please sign in to comment.