-
Notifications
You must be signed in to change notification settings - Fork 5
/
MeasurementUnitInput.java
213 lines (185 loc) · 5.34 KB
/
MeasurementUnitInput.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/*
* © 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;
import edu.ie3.datamodel.io.extractor.HasNodes;
import edu.ie3.datamodel.models.OperationTime;
import java.util.*;
/** Model of a measuring unit attached to a certain {@link NodeInput}. */
public class MeasurementUnitInput extends AssetInput implements HasNodes {
/** Grid node, the asset is attached to */
private final NodeInput node;
/** True, if the voltage magnitude is measured */
private final boolean vMag;
/** True, if the voltage angle is measured */
private final boolean vAng;
/** True, if the nodal residual active power is measured */
private final boolean p;
/** True, if the reactive power is measured */
private final boolean q;
/**
* Constructor for an operated measurement unit
*
* @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 node Grid node, the asset is attached to
* @param vMag True, if the voltage magnitude is measured
* @param vAng True, if the voltage angle is measured
* @param p True, if the nodal residual active power is measured
* @param q True, if the reactive power is measured
*/
public MeasurementUnitInput(
UUID uuid,
String id,
OperatorInput operator,
OperationTime operationTime,
NodeInput node,
boolean vMag,
boolean vAng,
boolean p,
boolean q) {
super(uuid, id, operator, operationTime);
this.node = node;
this.vMag = vMag;
this.vAng = vAng;
this.p = p;
this.q = q;
}
/**
* Constructor for an operated, always on measurement unit
*
* @param uuid of the input entity
* @param id of the asset
* @param node Grid node, the asset is attached to
* @param vMag True, if the voltage magnitude is measured
* @param vAng True, if the voltage angle is measured
* @param p True, if the nodal residual active power is measured
* @param q True, if the reactive power is measured
*/
public MeasurementUnitInput(
UUID uuid, String id, NodeInput node, boolean vMag, boolean vAng, boolean p, boolean q) {
super(uuid, id);
this.node = node;
this.vMag = vMag;
this.vAng = vAng;
this.p = p;
this.q = q;
}
public NodeInput getNode() {
return node;
}
public boolean getVMag() {
return vMag;
}
public boolean getVAng() {
return vAng;
}
public boolean getP() {
return p;
}
public boolean getQ() {
return q;
}
public MeasurementUnitInputCopyBuilder copy() {
return new MeasurementUnitInputCopyBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof MeasurementUnitInput that)) return false;
if (!super.equals(o)) return false;
return Objects.equals(node, that.node)
&& vMag == that.vMag
&& vAng == that.vAng
&& p == that.p
&& q == that.q;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), node, vMag, vAng, p, q);
}
@Override
public String toString() {
return "MeasurementUnitInput{"
+ "uuid="
+ getUuid()
+ ", id="
+ getId()
+ ", operator="
+ getOperator().getUuid()
+ ", operationTime="
+ getOperationTime()
+ ", node="
+ node.getUuid()
+ ", vMag="
+ vMag
+ ", vAng="
+ vAng
+ ", p="
+ p
+ ", q="
+ q
+ '}';
}
@Override
public List<NodeInput> allNodes() {
return Collections.singletonList(node);
}
/**
* A builder pattern based approach to create copies of {@link MeasurementUnitInput} entities with
* altered field values. For detailed field descriptions refer to java docs of {@link
* MeasurementUnitInput}
*
* @version 0.1
* @since 05.06.20
*/
public static class MeasurementUnitInputCopyBuilder
extends AssetInputCopyBuilder<MeasurementUnitInputCopyBuilder> {
private NodeInput node;
private boolean vMag;
private boolean vAng;
private boolean p;
private boolean q;
private MeasurementUnitInputCopyBuilder(MeasurementUnitInput entity) {
super(entity);
this.node = entity.getNode();
this.vAng = entity.getVAng();
this.vMag = entity.getVMag();
this.p = entity.getP();
this.q = entity.getQ();
}
@Override
public MeasurementUnitInput build() {
return new MeasurementUnitInput(
getUuid(), getId(), getOperator(), getOperationTime(), node, vMag, vAng, p, q);
}
public MeasurementUnitInputCopyBuilder node(NodeInput node) {
this.node = node;
return this;
}
public MeasurementUnitInputCopyBuilder vMag(boolean vMag) {
this.vMag = vMag;
return this;
}
public MeasurementUnitInputCopyBuilder vAng(boolean vAng) {
this.vAng = vAng;
return this;
}
public MeasurementUnitInputCopyBuilder p(boolean p) {
this.p = p;
return this;
}
public MeasurementUnitInputCopyBuilder q(boolean q) {
this.q = q;
return this;
}
@Override
protected MeasurementUnitInputCopyBuilder childInstance() {
return this;
}
}
}