-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
…rvice
- Loading branch information
Showing
9 changed files
with
129 additions
and
172 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
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
74 changes: 0 additions & 74 deletions
74
src/test/groovy/edu/ie3/simona/model/grid/RefSystemTest.groovy
This file was deleted.
Oops, something went wrong.
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.
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
56 changes: 56 additions & 0 deletions
56
src/test/scala/edu/ie3/simona/model/grid/RefSystemSpec.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,56 @@ | ||
/* | ||
* © 2020. TU Dortmund University, | ||
* Institute of Energy Systems, Energy Efficiency and Energy Economics, | ||
* Research group Distribution grid planning and operation | ||
*/ | ||
|
||
package edu.ie3.simona.model.grid | ||
|
||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
import squants.{Dimensionless, Each} | ||
import squants.electro.{Amperes, ElectricPotential, Kilovolts, Ohms} | ||
import squants.energy.{Megawatts, Power, Kilowatts} | ||
|
||
class RefSystemSpec extends AnyFlatSpec with Matchers { | ||
|
||
"A RefSystem with nominal power and nominal voltage" should "provide corresponding nominal current and nominal impedance" in { | ||
|
||
val nominalPower: Power = Kilowatts(600) | ||
val nominalVoltage: ElectricPotential = Kilovolts(10) | ||
|
||
val refSystem = RefSystem(nominalPower, nominalVoltage) | ||
|
||
refSystem.nominalPower should be(nominalPower) | ||
refSystem.nominalVoltage should be(nominalVoltage) | ||
refSystem.nominalCurrent should be( | ||
Amperes(34.64101615137754774109785366023500d) | ||
) | ||
refSystem.nominalImpedance should be( | ||
Ohms(166.6666666666666666666666666666666d) | ||
) | ||
} | ||
|
||
"A dimensionless impedance" should "be transferred correctly between reference systems" in { | ||
val from = RefSystem(Megawatts(60d), Kilovolts(110d)) | ||
val to = RefSystem(Megawatts(40d), Kilovolts(110d)) | ||
val impedance = Each(0.1d) | ||
val expected = Each(0.06666666666666667d) | ||
|
||
val actual: Dimensionless = RefSystem.transferImpedance(impedance, from, to) | ||
|
||
actual should be(expected) | ||
} | ||
|
||
"A dimensionless admittance" should "be transferred correctly between reference systems" in { | ||
val from = RefSystem(Megawatts(60d), Kilovolts(110d)) | ||
val to = RefSystem(Megawatts(40d), Kilovolts(110d)) | ||
val admittance = Each(0.1d) | ||
val expected = Each(0.15000000000000002d) | ||
|
||
val actual: Dimensionless = | ||
RefSystem.transferAdmittance(admittance, from, to) | ||
|
||
actual should be(expected) | ||
} | ||
} |
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 | ||
} | ||
} | ||
|
||
} | ||
} |