-
Notifications
You must be signed in to change notification settings - Fork 5
/
EmInput.java
176 lines (155 loc) · 5.19 KB
/
EmInput.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
/*
* © 2022. 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.models.ControlStrategy;
import edu.ie3.datamodel.models.EmControlStrategy;
import edu.ie3.datamodel.models.OperationTime;
import edu.ie3.datamodel.models.input.AssetInput;
import edu.ie3.datamodel.models.input.OperatorInput;
import java.util.Arrays;
import java.util.Objects;
import java.util.UUID;
public class EmInput extends AssetInput {
/** Reference via UUID to all SystemParticipantInputs connected to this model */
private final UUID[] connectedAssets;
/** Reference to the control strategy to be used for this model */
private final ControlStrategy controlStrategy;
/**
* Constructor for an operated energy management system
*
* @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 connectedAssets array of all connected assets
* @param controlStrategy control strategy used for this model
*/
public EmInput(
UUID uuid,
String id,
OperatorInput operator,
OperationTime operationTime,
UUID[] connectedAssets,
ControlStrategy controlStrategy) {
super(uuid, id, operator, operationTime);
this.connectedAssets = connectedAssets;
this.controlStrategy = controlStrategy;
}
/**
* Constructor for an operated energy management system
*
* @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 connectedAssets array of all connected assets
* @param emControlStrategy {@link edu.ie3.datamodel.models.EmControlStrategy} control strategy
* key
*/
public EmInput(
UUID uuid,
String id,
OperatorInput operator,
OperationTime operationTime,
UUID[] connectedAssets,
String emControlStrategy) {
super(uuid, id, operator, operationTime);
this.connectedAssets = connectedAssets;
this.controlStrategy = EmControlStrategy.get(emControlStrategy);
}
/**
* Constructor for an operated energy management system
*
* @param uuid of the input entity
* @param id of the asset
* @param connectedAssets array of all connected assets
* @param controlStrategy control strategy used for this model
*/
public EmInput(UUID uuid, String id, UUID[] connectedAssets, ControlStrategy controlStrategy) {
super(uuid, id);
this.connectedAssets = connectedAssets;
this.controlStrategy = controlStrategy;
}
/**
* Constructor for an operated energy management system
*
* @param uuid of the input entity
* @param id of the asset
* @param connectedAssets array of all connected assets
* @param emControlStrategy {@link edu.ie3.datamodel.models.EmControlStrategy} control strategy
* key
*/
public EmInput(UUID uuid, String id, UUID[] connectedAssets, String emControlStrategy) {
super(uuid, id);
this.connectedAssets = connectedAssets;
this.controlStrategy = EmControlStrategy.get(emControlStrategy);
}
public UUID[] getConnectedAssets() {
return connectedAssets;
}
public ControlStrategy getControlStrategy() {
return controlStrategy;
}
@Override
public EmInputCopyBuilder copy() {
return new EmInputCopyBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof EmInput emInput)) return false;
if (!super.equals(o)) return false;
return Arrays.equals(connectedAssets, emInput.connectedAssets)
&& controlStrategy == emInput.controlStrategy;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), Arrays.hashCode(connectedAssets), controlStrategy);
}
@Override
public String toString() {
return "EmInput{"
+ "uuid="
+ getUuid()
+ ", id='"
+ getId()
+ ", operator="
+ getOperator().getUuid()
+ ", operationTime="
+ getOperationTime()
+ ", connectedAssets="
+ Arrays.toString(connectedAssets)
+ ", controlStrategy="
+ controlStrategy
+ '}';
}
public static class EmInputCopyBuilder extends AssetInputCopyBuilder<EmInputCopyBuilder> {
private UUID[] connectedAssets;
private ControlStrategy controlStrategy;
protected EmInputCopyBuilder(EmInput entity) {
super(entity);
this.connectedAssets = entity.getConnectedAssets();
this.controlStrategy = entity.getControlStrategy();
}
public EmInputCopyBuilder connectedAssets(UUID[] connectedAssets) {
this.connectedAssets = connectedAssets;
return this;
}
public EmInputCopyBuilder controlStrategy(ControlStrategy controlStrategy) {
this.controlStrategy = controlStrategy;
return this;
}
@Override
public EmInput build() {
return new EmInput(
getUuid(), getId(), getOperator(), getOperationTime(), connectedAssets, controlStrategy);
}
@Override
protected EmInputCopyBuilder thisInstance() {
return this;
}
}
}