Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FixedfeedModelSpec-convert-groovy-tests-to-scalatest #832

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}

}
}