Skip to content

Commit

Permalink
Added integration test for Line Type Mismatch issue. Added requested …
Browse files Browse the repository at this point in the history
…warning comment in LineConverter.
  • Loading branch information
Utkarsha-dev05 committed Dec 30, 2021
1 parent e7e739b commit 8768218
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/scala/edu/ie3/simbench/convert/LineConverter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ case object LineConverter extends LazyLogging {
case acLine: Line.ACLine =>
val (nodeA, nodeB) =
NodeConverter.getNodes(acLine.nodeA, acLine.nodeB, nodes)
/**
* This part of the code works only if no calculations are done with the voltage provided here.
*/
val lineType = types.getOrElse(
(acLine.lineType, Quantities.getQuantity(acLine.nodeA.vmR, KILOVOLT)),
throw ConversionException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,28 @@ class LineTypeConverterSpec extends UnitSpec with ConverterTestData {
7
)
)
val EHVlines = Vector(
ACLine(
"EHV Line 4",
getNodePair("EHV Bus 49")._1,
getNodePair("EHV Bus 59")._1,
getACLineTypes("LineType_1")._1,
BigDecimal("194.581"),
BigDecimal("100"),
"EHV 1",
1
),
ACLine(
"EHV Line 273",
getNodePair("EHV Bus 1433")._1,
getNodePair("EHV Bus 1435")._1,
getACLineTypes("LineType_1")._1,
BigDecimal("43.396"),
BigDecimal("100"),
"EHV 1",
1
)
)

val uuid: UUID = UUID.randomUUID()

Expand Down Expand Up @@ -90,7 +112,7 @@ class LineTypeConverterSpec extends UnitSpec with ConverterTestData {
getACLineTypes("NAYY 4x150SE 0.6/1kV")._1 -> Quantities
.getQuantity(0.4, KILOVOLT),
getACLineTypes("24-AL1/4-ST1A 20.0")._1 -> Quantities
.getQuantity(0.4, KILOVOLT)
.getQuantity(0.4, KILOVOLT)
)
actual.toSet shouldBe expected.toSet
}
Expand Down Expand Up @@ -136,5 +158,19 @@ class LineTypeConverterSpec extends UnitSpec with ConverterTestData {
)
thrown.getMessage shouldBe "DC line types are currently not supported by ie3's data model."
}

"extract the rated voltage of lines with same line type but different rated voltages correctly" in {
val actual = LineTypeConverter invokePrivate determineRatedVoltageMethod(
EHVlines(0)
)
actual shouldBe (getACLineTypes("LineType_1")._1, Quantities
.getQuantity(380, KILOVOLT))
val actualVal = LineTypeConverter invokePrivate determineRatedVoltageMethod(
EHVlines(1)
)
actualVal shouldBe (getACLineTypes("LineType_1")._1, Quantities
.getQuantity(220, KILOVOLT))
}

}
}
147 changes: 147 additions & 0 deletions src/test/scala/edu/ie3/test/common/ConverterTestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,110 @@ trait ConverterTestData {
LV,
2
)
),
"EHV Bus 49" -> ConversionPair(
Node(
"EHV Bus 49",
DoubleBusBar,
Some(BigDecimal("1.092")),
None,
BigDecimal("380"),
BigDecimal("0.9"),
BigDecimal("1.1"),
None,
None,
"EHV1",
1
),
new NodeInput(
UUID.randomUUID(),
"EHV Bus 49",
OperatorInput.NO_OPERATOR_ASSIGNED,
OperationTime.notLimited(),
Quantities.getQuantity(1.092, PU),
false,
NodeInput.DEFAULT_GEO_POSITION,
GermanVoltageLevelUtils.EHV_380KV,
1
)
),
"EHV Bus 59" -> ConversionPair(
Node(
"EHV Bus 59",
DoubleBusBar,
None,
None,
BigDecimal("380"),
BigDecimal("0.9"),
BigDecimal("1.1"),
None,
None,
"EHV1",
1
),
new NodeInput(
UUID.randomUUID(),
"EHV Bus 59",
OperatorInput.NO_OPERATOR_ASSIGNED,
OperationTime.notLimited(),
Quantities.getQuantity(0, PU),
false,
NodeInput.DEFAULT_GEO_POSITION,
GermanVoltageLevelUtils.EHV_380KV,
1
)
),
"EHV Bus 1433" -> ConversionPair(
Node(
"EHV Bus 1433",
DoubleBusBar,
Some(BigDecimal("1.068")),
None,
BigDecimal("220"),
BigDecimal("0.9"),
BigDecimal("1.1"),
None,
None,
"EHV1",
1
),
new NodeInput(
UUID.randomUUID(),
"EHV Bus 1433",
OperatorInput.NO_OPERATOR_ASSIGNED,
OperationTime.notLimited(),
Quantities.getQuantity(1.068, PU),
false,
NodeInput.DEFAULT_GEO_POSITION,
GermanVoltageLevelUtils.EHV_220KV,
1
)
),
"EHV Bus 1435" -> ConversionPair(
Node(
"EHV Bus 1435",
DoubleBusBar,
None,
None,
BigDecimal("220"),
BigDecimal("0.9"),
BigDecimal("1.1"),
None,
None,
"EHV1",
1
),
new NodeInput(
UUID.randomUUID(),
"EHV Bus 1435",
OperatorInput.NO_OPERATOR_ASSIGNED,
OperationTime.notLimited(),
Quantities.getQuantity(0, PU),
false,
NodeInput.DEFAULT_GEO_POSITION,
GermanVoltageLevelUtils.EHV_220KV,
1
)
)
)

Expand Down Expand Up @@ -463,7 +567,50 @@ trait ConverterTestData {
Quantities.getQuantity(652d, ELECTRIC_CURRENT_MAGNITUDE),
Quantities.getQuantity(20d, RATED_VOLTAGE_MAGNITUDE)
)
),
"LineType_1" -> ConversionPair(
ACLineType(
"LineType_1",
BigDecimal("0.08"),
BigDecimal("0.32"),
BigDecimal("361.283"),
BigDecimal("1300"),
LineStyle.OverheadLine
),
new LineTypeInput(
UUID.randomUUID(),
"LineType_1",
Quantities
.getQuantity(361.283d, ADMITTANCE_PER_LENGTH),
Quantities.getQuantity(0d, ADMITTANCE_PER_LENGTH),
Quantities.getQuantity(0.08d, IMPEDANCE_PER_LENGTH),
Quantities.getQuantity(0.32d, IMPEDANCE_PER_LENGTH),
Quantities.getQuantity(1300d, ELECTRIC_CURRENT_MAGNITUDE),
Quantities.getQuantity(220d, RATED_VOLTAGE_MAGNITUDE)
)
),
"LineType_1" -> ConversionPair(
ACLineType(
"LineType_1",
BigDecimal("0.08"),
BigDecimal("0.32"),
BigDecimal("361.283"),
BigDecimal("1300"),
LineStyle.OverheadLine
),
new LineTypeInput(
UUID.randomUUID(),
"LineType_1",
Quantities
.getQuantity(361.283d, ADMITTANCE_PER_LENGTH),
Quantities.getQuantity(0d, ADMITTANCE_PER_LENGTH),
Quantities.getQuantity(0.08d, IMPEDANCE_PER_LENGTH),
Quantities.getQuantity(0.32d, IMPEDANCE_PER_LENGTH),
Quantities.getQuantity(1300d, ELECTRIC_CURRENT_MAGNITUDE),
Quantities.getQuantity(380d, RATED_VOLTAGE_MAGNITUDE)
)
)

)

val dcLineTypes = Map(
Expand Down

0 comments on commit 8768218

Please sign in to comment.