-
Notifications
You must be signed in to change notification settings - Fork 5
/
PvInputTest.groovy
74 lines (64 loc) · 2.6 KB
/
PvInputTest.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* © 2021. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
package edu.ie3.datamodel.models.input.system
import static edu.ie3.util.quantities.PowerSystemUnits.DEGREE_GEOM
import static edu.ie3.util.quantities.PowerSystemUnits.KILOVOLTAMPERE
import static tech.units.indriya.unit.Units.PERCENT
import edu.ie3.test.common.SystemParticipantTestData
import spock.lang.Specification
import tech.units.indriya.quantity.Quantities
class PvInputTest extends Specification {
def "A PvInput copy method should work as expected"() {
given:
def pvInput = SystemParticipantTestData.pvInput
when:
def alteredUnit = pvInput.copy().albedo(10).azimuth(Quantities.getQuantity(10, DEGREE_GEOM)).elevationAngle(Quantities.getQuantity(50, DEGREE_GEOM))
.etaConv(Quantities.getQuantity(50d, PERCENT)).kG(10).kT(5).marketReaction(true).sRated(Quantities.getQuantity(0d, KILOVOLTAMPERE))
.cosPhiRated(0.7d).build()
then:
alteredUnit.with {
assert uuid == pvInput.uuid
assert operationTime == pvInput.operationTime
assert operator == pvInput.operator
assert id == pvInput.id
assert qCharacteristics == pvInput.qCharacteristics
assert sRated == Quantities.getQuantity(0d, KILOVOLTAMPERE)
assert cosPhiRated == 0.7d
assert marketReaction
assert albedo == 10
assert azimuth == Quantities.getQuantity(10, DEGREE_GEOM)
assert etaConv == Quantities.getQuantity(50, PERCENT)
assert elevationAngle == Quantities.getQuantity(50, DEGREE_GEOM)
assert kG == 10
assert kT == 5
assert em == Optional.of(SystemParticipantTestData.emInput)
}
}
def "Scaling a PvInput via builder should work as expected"() {
given:
def pvInput = SystemParticipantTestData.pvInput
when:
def alteredUnit = pvInput.copy().scale(2d).build()
then:
alteredUnit.with {
assert uuid == pvInput.uuid
assert operationTime == pvInput.operationTime
assert operator == pvInput.operator
assert id == pvInput.id
assert qCharacteristics == pvInput.qCharacteristics
assert sRated == pvInput.sRated * 2d
assert cosPhiRated == pvInput.cosPhiRated
assert marketReaction == pvInput.marketReaction
assert albedo == pvInput.albedo
assert azimuth == pvInput.azimuth
assert etaConv == pvInput.etaConv
assert elevationAngle == pvInput.elevationAngle
assert kG == pvInput.kG
assert kT == pvInput.kT
assert em == Optional.of(SystemParticipantTestData.emInput)
}
}
}