-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
4 changed files
with
59 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 0 additions & 79 deletions
79
src/test/groovy/edu/ie3/simona/model/participant/FixedFeedModelTest.groovy
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
src/test/scala/edu/ie3/simona/model/participant/FixedFeedModelSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
|
||
} | ||
} |