-
Notifications
You must be signed in to change notification settings - Fork 5
/
Transformer2WInput.java
171 lines (155 loc) · 5.13 KB
/
Transformer2WInput.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
167
168
169
170
171
/*
* © 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 static edu.ie3.datamodel.utils.validation.ConnectorValidationUtils.connectsNodesToCorrectVoltageSides;
import edu.ie3.datamodel.io.extractor.HasType;
import edu.ie3.datamodel.models.OperationTime;
import edu.ie3.datamodel.models.input.NodeInput;
import edu.ie3.datamodel.models.input.OperatorInput;
import edu.ie3.datamodel.models.input.connector.type.Transformer2WTypeInput;
import java.util.Objects;
import java.util.UUID;
/**
* Describes a two winding transformer, that is connected to two {@link
* edu.ie3.datamodel.models.input.NodeInput}s
*/
public class Transformer2WInput extends TransformerInput implements HasType {
/** Type of this 2W transformer, containing default values for transformers of this kind */
private final Transformer2WTypeInput type;
/**
* Constructor for an operated two winding transformer
*
* @param uuid of the input entity
* @param id of the asset
* @param operator of the asset
* @param operationTime Time for which the entity is operated
* @param nodeA higher voltage node
* @param nodeB lower voltage node
* @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 type of 2W transformer
* @param tapPos Tap position of this transformer
* @param autoTap True, if the tap position of the transformer is adapted automatically
*/
public Transformer2WInput(
UUID uuid,
String id,
OperatorInput operator,
OperationTime operationTime,
NodeInput nodeA,
NodeInput nodeB,
int parallelDevices,
Transformer2WTypeInput type,
int tapPos,
boolean autoTap) {
super(uuid, operationTime, operator, id, nodeA, nodeB, parallelDevices, tapPos, autoTap);
connectsNodesToCorrectVoltageSides(nodeA, nodeB);
this.type = type;
}
/**
* Constructor for an operated, always on two winding transformer
*
* @param uuid of the input entity
* @param id of the asset
* @param nodeA higher voltage node
* @param nodeB lower voltage node
* @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 type of 2W transformer
* @param tapPos Tap position of this transformer
* @param autoTap True, if the tap position of the transformer is adapted automatically
*/
public Transformer2WInput(
UUID uuid,
String id,
NodeInput nodeA,
NodeInput nodeB,
int parallelDevices,
Transformer2WTypeInput type,
int tapPos,
boolean autoTap) {
super(uuid, id, nodeA, nodeB, parallelDevices, tapPos, autoTap);
connectsNodesToCorrectVoltageSides(nodeA, nodeB);
this.type = type;
}
public Transformer2WInputCopyBuilder copy() {
return new Transformer2WInputCopyBuilder(this);
}
@Override
public Transformer2WTypeInput getType() {
return type;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Transformer2WInput that)) return false;
if (!super.equals(o)) return false;
return type.equals(that.type);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), type);
}
@Override
public String toString() {
return "Transformer2WInput{"
+ "uuid="
+ getUuid()
+ ", id="
+ getId()
+ ", operator="
+ getOperator().getUuid()
+ ", operationTime="
+ getOperationTime()
+ ", nodeA="
+ getNodeA().getUuid()
+ ", nodeB="
+ getNodeB().getUuid()
+ ", noOfParallelDevices="
+ getParallelDevices()
+ ", type="
+ type.getUuid()
+ '}';
}
/**
* A builder pattern based approach to create copies of {@link Transformer2WInput} entities with
* altered field values. For detailed field descriptions refer to java docs of {@link
* Transformer2WInput}
*
* @version 0.1
* @since 05.06.20
*/
public static class Transformer2WInputCopyBuilder
extends TransformerInputCopyBuilder<Transformer2WInputCopyBuilder> {
private Transformer2WTypeInput type;
private Transformer2WInputCopyBuilder(Transformer2WInput entity) {
super(entity);
this.type = entity.getType();
}
@Override
public Transformer2WInput build() {
return new Transformer2WInput(
getUuid(),
getId(),
getOperator(),
getOperationTime(),
getNodeA(),
getNodeB(),
getParallelDevices(),
type,
getTapPos(),
isAutoTap());
}
public Transformer2WInputCopyBuilder type(Transformer2WTypeInput type) {
this.type = type;
return this;
}
@Override
protected Transformer2WInputCopyBuilder childInstance() {
return this;
}
}
}