-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: dev
Are you sure you want to change the base?
Changes from all commits
3f6cf13
cccad44
97c03b6
dc764e0
bf73c61
0c9b531
1fbb285
b22f844
d338fec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* © 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 { | ||
|
||
val expectedPower = Kilowatts( | ||
fixedFeedInput | ||
.getsRated() | ||
.to(PowerSystemUnits.KILOWATT) | ||
.getValue | ||
.doubleValue() * -1 * fixedFeedInput.getCosPhiRated | ||
) | ||
|
||
"The fixed feed model" should { | ||
"return approximately correct power calculations" in { | ||
val actualModel = new FixedFeedInModel( | ||
fixedFeedInput.getUuid, | ||
fixedFeedInput.getId, | ||
defaultOperationInterval, | ||
QControl.apply(fixedFeedInput.getqCharacteristics()), | ||
Sq.create( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please refactor this Sq. here as well :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one was marked as resolved accidentially by me. Sorry, please use Kilowatts() here |
||
fixedFeedInput | ||
.getsRated() | ||
.to(PowerSystemUnits.KILOWATT) | ||
.getValue | ||
.doubleValue(), | ||
Kilowatts, | ||
), | ||
fixedFeedInput.getCosPhiRated, | ||
) | ||
|
||
actualModel.calculateActivePower( | ||
ModelState.ConstantState, | ||
CalcRelevantData.FixedRelevantData, | ||
) =~ expectedPower | ||
} | ||
} | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a format thing, since this expected power belongs to the test
return approx correct power calculations
just move it down there. Maybe at a later time there will be additional tests here and the expected power should only be valid where it belongs to.