-
Notifications
You must be signed in to change notification settings - Fork 5
/
TransformerInput.java
166 lines (147 loc) · 4.68 KB
/
TransformerInput.java
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
* © 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.connector;
import edu.ie3.datamodel.models.OperationTime;
import edu.ie3.datamodel.models.input.NodeInput;
import edu.ie3.datamodel.models.input.OperatorInput;
import java.util.Objects;
import java.util.UUID;
/** Describes an electrical grid transformer, is "located" in the inferior subnet */
public abstract class TransformerInput extends ConnectorInput {
/** Tap position of this transformer */
private final int tapPos;
/** True, if the tap position of the transformer is adapted automatically */
private final boolean autoTap;
/**
* Constructor for an operated transformer
*
* @param uuid of the input entity
* @param operationTime Time for which the entity is operated
* @param operator of the asset
* @param id of the asset
* @param nodeA Grid node at the high voltage winding
* @param nodeB Grid node at the low voltage winding
* @param parallelDevices overall amount of parallel transformers to automatically construct (e.g.
* parallelDevices = 2 will build a total of two transformers using the specified parameters)
* @param tapPos Tap Position of this transformer
* @param autoTap True, if the tap position of the transformer is adapted automatically
*/
protected TransformerInput(
UUID uuid,
OperationTime operationTime,
OperatorInput operator,
String id,
NodeInput nodeA,
NodeInput nodeB,
int parallelDevices,
int tapPos,
boolean autoTap) {
super(uuid, id, operator, operationTime, nodeA, nodeB, parallelDevices);
this.tapPos = tapPos;
this.autoTap = autoTap;
}
/**
* Constructor for an operated, always on transformer
*
* @param uuid of the input entity
* @param id of the asset
* @param nodeA Grid node at the high voltage winding
* @param nodeB Grid node at the low voltage winding
* @param parallelDevices overall amount of parallel transformers to automatically construct (e.g.
* parallelDevices = 2 will build a total of two transformers using the specified parameters)
* @param tapPos Tap Position of this transformer
* @param autoTap True, if the tap position of the transformer is adapted automatically
*/
protected TransformerInput(
UUID uuid,
String id,
NodeInput nodeA,
NodeInput nodeB,
int parallelDevices,
int tapPos,
boolean autoTap) {
super(uuid, id, nodeA, nodeB, parallelDevices);
this.tapPos = tapPos;
this.autoTap = autoTap;
}
public boolean isAutoTap() {
return autoTap;
}
public int getTapPos() {
return tapPos;
}
@Override
public abstract TransformerInputCopyBuilder<? extends TransformerInputCopyBuilder<?>> copy();
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TransformerInput that)) return false;
if (!super.equals(o)) return false;
return tapPos == that.tapPos && autoTap == that.autoTap;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), tapPos, autoTap);
}
@Override
public String toString() {
return "TransformerInput{"
+ "uuid="
+ getUuid()
+ ", id="
+ getId()
+ ", operator="
+ getOperator().getUuid()
+ ", operationTime="
+ getOperationTime()
+ ", nodeA="
+ getNodeA().getUuid()
+ ", nodeB="
+ getNodeB().getUuid()
+ ", noOfParallelDevices="
+ getParallelDevices()
+ ", tapPos="
+ tapPos
+ ", autoTap="
+ autoTap
+ '}';
}
/**
* Abstract class for all builder that build child entities of abstract class {@link
* TransformerInput}
*
* @version 0.1
* @since 05.06.20
*/
public abstract static class TransformerInputCopyBuilder<B extends TransformerInputCopyBuilder<B>>
extends ConnectorInputCopyBuilder<B> {
private int tapPos;
private boolean autoTap;
protected TransformerInputCopyBuilder(TransformerInput entity) {
super(entity);
this.tapPos = entity.getTapPos();
this.autoTap = entity.isAutoTap();
}
public B tapPos(int tapPos) {
this.tapPos = tapPos;
return thisInstance();
}
public B autoTap(boolean autoTap) {
this.autoTap = autoTap;
return thisInstance();
}
protected int getTapPos() {
return tapPos;
}
protected boolean isAutoTap() {
return autoTap;
}
@Override
public abstract TransformerInput build();
@Override
protected abstract B thisInstance();
}
}