-
Notifications
You must be signed in to change notification settings - Fork 5
/
LoadInput.java
349 lines (322 loc) · 10.8 KB
/
LoadInput.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
/*
* © 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 edu.ie3.datamodel.exceptions.ParsingException;
import edu.ie3.datamodel.models.*;
import edu.ie3.datamodel.models.input.EmInput;
import edu.ie3.datamodel.models.input.NodeInput;
import edu.ie3.datamodel.models.input.OperatorInput;
import edu.ie3.datamodel.models.input.system.characteristic.ReactivePowerCharacteristic;
import edu.ie3.datamodel.models.profile.LoadProfile;
import edu.ie3.datamodel.models.profile.StandardLoadProfile;
import edu.ie3.datamodel.models.timeseries.individual.IndividualTimeSeries;
import edu.ie3.datamodel.models.timeseries.repetitive.RepetitiveTimeSeries;
import java.util.Objects;
import java.util.UUID;
import javax.measure.quantity.Energy;
import javax.measure.quantity.Power;
import tech.units.indriya.ComparableQuantity;
/** Describes a load */
public class LoadInput extends SystemParticipantInput {
/**
* Reference to a load profile to use for the model. If you intend to assign specific values,
* create an {@link IndividualTimeSeries} or {@link RepetitiveTimeSeries} and assign it via an
* external mapping (e.g. by providing a global time series for a specific load profile) to this
* model
*/
private final LoadProfile loadProfile;
/** True, if demand side management is activated for this load */
private final boolean dsm;
/** Annually consumed energy (typically in kWh) */
private final ComparableQuantity<Energy> eConsAnnual;
/** Active Power (typically in kVA) */
private final ComparableQuantity<Power> sRated;
/** Rated power factor */
private final double cosPhiRated;
/**
* Constructor for an operated load
*
* @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 the asset is connected to
* @param qCharacteristics Description of a reactive power characteristic
* @param em The {@link EmInput} controlling this system participant. Null, if not applicable.
* @param loadProfile Load profile to use for this model
* @param dsm True, if demand side management is activated for this load
* @param eConsAnnual Annually consumed energy (typically in kWh)
* @param sRated Rated apparent power (in kVA)
* @param cosPhiRated Rated power factor
*/
public LoadInput(
UUID uuid,
String id,
OperatorInput operator,
OperationTime operationTime,
NodeInput node,
ReactivePowerCharacteristic qCharacteristics,
EmInput em,
LoadProfile loadProfile,
boolean dsm,
ComparableQuantity<Energy> eConsAnnual,
ComparableQuantity<Power> sRated,
double cosPhiRated) {
super(uuid, id, operator, operationTime, node, qCharacteristics, em);
this.loadProfile = loadProfile;
this.dsm = dsm;
this.eConsAnnual = eConsAnnual.to(StandardUnits.ENERGY_IN);
this.sRated = sRated.to(StandardUnits.S_RATED);
this.cosPhiRated = cosPhiRated;
}
/**
* Constructor for an operated load
*
* @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 node the asset is connected to
* @param qCharacteristics Description of a reactive power characteristic
* @param em The {@link EmInput} controlling this system participant. Null, if not applicable.
* @param loadProfileKey Load profile key corresponding to {@link
* edu.ie3.datamodel.models.profile.BdewStandardLoadProfile} or {@link
* edu.ie3.datamodel.models.profile.NbwTemperatureDependantLoadProfile}
* @param dsm True, if demand side management is activated for this load
* @param eConsAnnual Annually consumed energy (typically in kWh)
* @param sRated Rated apparent power (in kVA)
* @param cosPhiRated Rated power factor
*/
public LoadInput(
UUID uuid,
OperationTime operationTime,
OperatorInput operator,
String id,
NodeInput node,
ReactivePowerCharacteristic qCharacteristics,
EmInput em,
String loadProfileKey,
boolean dsm,
ComparableQuantity<Energy> eConsAnnual,
ComparableQuantity<Power> sRated,
double cosPhiRated)
throws ParsingException {
this(
uuid,
id,
operator,
operationTime,
node,
qCharacteristics,
em,
LoadProfile.parse(loadProfileKey),
dsm,
eConsAnnual,
sRated,
cosPhiRated);
}
/**
* Constructor for an operated, always on load
*
* @param uuid of the input entity
* @param id of the asset
* @param node the asset is connected to
* @param qCharacteristics Description of a reactive power characteristic
* @param em The {@link EmInput} controlling this system participant. Null, if not applicable.
* @param loadProfile Standard load profile to use for this model
* @param dsm True, if demand side management is activated for this load
* @param eConsAnnual Annually consumed energy (typically in kWh)
* @param sRated Rated apparent power (in kVA)
* @param cosPhiRated Rated power factor
*/
public LoadInput(
UUID uuid,
String id,
NodeInput node,
ReactivePowerCharacteristic qCharacteristics,
EmInput em,
LoadProfile loadProfile,
boolean dsm,
ComparableQuantity<Energy> eConsAnnual,
ComparableQuantity<Power> sRated,
double cosPhiRated) {
super(uuid, id, node, qCharacteristics, em);
this.loadProfile = loadProfile;
this.dsm = dsm;
this.eConsAnnual = eConsAnnual.to(StandardUnits.ENERGY_IN);
this.sRated = sRated.to(StandardUnits.S_RATED);
this.cosPhiRated = cosPhiRated;
}
/**
* Constructor for an operated, always on load
*
* @param uuid of the input entity
* @param id of the asset
* @param node the asset is connected to
* @param qCharacteristics Description of a reactive power characteristic
* @param em The {@link EmInput} controlling this system participant. Null, if not applicable.
* @param loadProfileKey load profile key corresponding to {@link
* edu.ie3.datamodel.models.profile.BdewStandardLoadProfile} or {@link
* edu.ie3.datamodel.models.profile.NbwTemperatureDependantLoadProfile}
* @param dsm True, if demand side management is activated for this load
* @param eConsAnnual Annually consumed energy (typically in kWh)
* @param sRated Rated apparent power (in kVA)
* @param cosPhiRated Rated power factor
*/
public LoadInput(
UUID uuid,
String id,
NodeInput node,
ReactivePowerCharacteristic qCharacteristics,
EmInput em,
String loadProfileKey,
boolean dsm,
ComparableQuantity<Energy> eConsAnnual,
ComparableQuantity<Power> sRated,
double cosPhiRated)
throws ParsingException {
this(
uuid,
id,
node,
qCharacteristics,
em,
LoadProfile.parse(loadProfileKey),
dsm,
eConsAnnual,
sRated,
cosPhiRated);
}
public LoadProfile getLoadProfile() {
return loadProfile;
}
public boolean isDsm() {
return dsm;
}
public ComparableQuantity<Energy> geteConsAnnual() {
return eConsAnnual;
}
public ComparableQuantity<Power> getsRated() {
return sRated;
}
public double getCosPhiRated() {
return cosPhiRated;
}
public LoadInputCopyBuilder copy() {
return new LoadInputCopyBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof LoadInput loadInput)) return false;
if (!super.equals(o)) return false;
return dsm == loadInput.dsm
&& Double.compare(loadInput.cosPhiRated, cosPhiRated) == 0
&& eConsAnnual.equals(loadInput.eConsAnnual)
&& loadProfile.equals(loadInput.loadProfile)
&& sRated.equals(loadInput.sRated);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), dsm, eConsAnnual, sRated, cosPhiRated);
}
@Override
public String toString() {
return "LoadInput{"
+ "uuid="
+ getUuid()
+ ", id='"
+ getId()
+ ", operator="
+ getOperator().getUuid()
+ ", operationTime="
+ getOperationTime()
+ ", node="
+ getNode().getUuid()
+ ", qCharacteristics='"
+ getqCharacteristics()
+ "', em="
+ getControllingEm()
+ ", dsm="
+ dsm
+ ", eConsAnnual="
+ eConsAnnual
+ ", sRated="
+ sRated
+ ", cosphiRated="
+ cosPhiRated
+ '}';
}
/**
* A builder pattern based approach to create copies of {@link LoadInput} entities with altered
* field values. For detailed field descriptions refer to java docs of {@link LoadInput}
*
* @version 0.1
* @since 05.06.20
*/
public static class LoadInputCopyBuilder
extends SystemParticipantInputCopyBuilder<LoadInputCopyBuilder> {
private LoadProfile loadProfile;
private boolean dsm;
private ComparableQuantity<Energy> eConsAnnual;
private ComparableQuantity<Power> sRated;
private double cosPhiRated;
private LoadInputCopyBuilder(LoadInput entity) {
super(entity);
this.loadProfile = entity.getLoadProfile();
this.dsm = entity.isDsm();
this.eConsAnnual = entity.geteConsAnnual();
this.sRated = entity.getsRated();
this.cosPhiRated = entity.getCosPhiRated();
}
public LoadInputCopyBuilder loadprofile(StandardLoadProfile standardLoadProfile) {
this.loadProfile = standardLoadProfile;
return this;
}
public LoadInputCopyBuilder dsm(boolean dsm) {
this.dsm = dsm;
return this;
}
public LoadInputCopyBuilder eConsAnnual(ComparableQuantity<Energy> eConsAnnual) {
this.eConsAnnual = eConsAnnual;
return this;
}
public LoadInputCopyBuilder sRated(ComparableQuantity<Power> sRated) {
this.sRated = sRated;
return this;
}
public LoadInputCopyBuilder cosPhiRated(double cosPhiRated) {
this.cosPhiRated = cosPhiRated;
return this;
}
@Override
public LoadInputCopyBuilder scale(Double factor) {
eConsAnnual(eConsAnnual.multiply(factor));
sRated(sRated.multiply(factor));
return this;
}
@Override
public LoadInput build() {
return new LoadInput(
getUuid(),
getId(),
getOperator(),
getOperationTime(),
getNode(),
getqCharacteristics(),
getEm(),
loadProfile,
dsm,
eConsAnnual,
sRated,
cosPhiRated);
}
@Override
protected LoadInputCopyBuilder thisInstance() {
return this;
}
}
}