-
Notifications
You must be signed in to change notification settings - Fork 5
/
EvTypeInput.java
188 lines (165 loc) · 5.53 KB
/
EvTypeInput.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
/*
* © 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.type;
import edu.ie3.datamodel.models.StandardUnits;
import edu.ie3.util.quantities.interfaces.Currency;
import edu.ie3.util.quantities.interfaces.EnergyPrice;
import edu.ie3.util.quantities.interfaces.SpecificEnergy;
import java.util.Objects;
import java.util.UUID;
import javax.measure.quantity.Energy;
import javax.measure.quantity.Power;
import tech.units.indriya.ComparableQuantity;
/** Describes the type of a {@link edu.ie3.datamodel.models.input.system.EvInput} */
public class EvTypeInput extends SystemParticipantTypeInput {
/** Energy capacity of the storage (typically in kWh) */
private final ComparableQuantity<Energy> eStorage;
/** Consumed electric energy per driven distance (typically in kWh/km) */
private final ComparableQuantity<SpecificEnergy> eCons;
/** power for DC (typically in kW) */
private final ComparableQuantity<Power> sRatedDC;
/**
* @param uuid of the input entity
* @param id of this type of EV
* @param capex Capital expense for this type of EV (typically in €)
* @param opex Operating expense for this type of EV (typically in €)
* @param eStorage Energy capacity of the storage
* @param eCons Consumed electric energy per driven distance
* @param sRatedAC Rated apparent power for this type of EV (typically in kVA)
* @param cosphiRated Power factor for this type of EV
* @param sRatedDC power for DC (typically in kW)
*/
public EvTypeInput(
UUID uuid,
String id,
ComparableQuantity<Currency> capex,
ComparableQuantity<EnergyPrice> opex,
ComparableQuantity<Energy> eStorage,
ComparableQuantity<SpecificEnergy> eCons,
ComparableQuantity<Power> sRatedAC,
double cosphiRated,
ComparableQuantity<Power> sRatedDC) {
super(uuid, id, capex, opex, sRatedAC.to(StandardUnits.S_RATED), cosphiRated);
this.eStorage = eStorage.to(StandardUnits.ENERGY_IN);
this.eCons = eCons.to(StandardUnits.ENERGY_PER_DISTANCE);
this.sRatedDC = sRatedDC.to(StandardUnits.ACTIVE_POWER_IN);
}
public ComparableQuantity<Energy> geteStorage() {
return eStorage;
}
public ComparableQuantity<SpecificEnergy> geteCons() {
return eCons;
}
public ComparableQuantity<Power> getsRatedDC() {
return sRatedDC;
}
public ComparableQuantity<Power> getsRatedAC() {
return getsRated();
}
@Override
public EvTypeInputCopyBuilder copy() {
return new EvTypeInputCopyBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof EvTypeInput that)) return false;
if (!super.equals(o)) return false;
return eStorage.equals(that.eStorage)
&& eCons.equals(that.eCons)
&& sRatedDC.equals(that.sRatedDC);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), eStorage, eCons, sRatedDC);
}
@Override
public String toString() {
return "EvTypeInput{"
+ "uuid="
+ getUuid()
+ ", id="
+ getId()
+ "capex="
+ getCapex()
+ ", opex="
+ getOpex()
+ ", sRatedAC="
+ getsRatedAC()
+ ", cosphiRated="
+ getCosPhiRated()
+ "eStorage="
+ eStorage
+ ", eCons="
+ eCons
+ ", sRatedDC="
+ sRatedDC
+ '}';
}
/**
* A builder pattern based approach to create copies of {@link EvTypeInput} entities with altered
* field values. For detailed field descriptions refer to java docs of {@link EvTypeInput}
*/
public static class EvTypeInputCopyBuilder
extends SystemParticipantTypeInputCopyBuilder<EvTypeInput.EvTypeInputCopyBuilder> {
private ComparableQuantity<Energy> eStorage;
private ComparableQuantity<SpecificEnergy> eCons;
private ComparableQuantity<Power> sRatedDC;
private EvTypeInputCopyBuilder(EvTypeInput entity) {
super(entity);
this.eStorage = entity.geteStorage();
this.eCons = entity.geteCons();
this.sRatedDC = entity.getsRatedDC();
}
public EvTypeInputCopyBuilder seteStorage(ComparableQuantity<Energy> eStorage) {
this.eStorage = eStorage;
return this;
}
public EvTypeInputCopyBuilder seteCons(ComparableQuantity<SpecificEnergy> eCons) {
this.eCons = eCons;
return this;
}
public EvTypeInputCopyBuilder setsRatedDC(ComparableQuantity<Power> sRatedDC) {
this.sRatedDC = sRatedDC;
return this;
}
public ComparableQuantity<Energy> geteStorage() {
return eStorage;
}
public ComparableQuantity<SpecificEnergy> geteCons() {
return eCons;
}
public ComparableQuantity<Power> getsRatedDC() {
return sRatedDC;
}
@Override
public EvTypeInput.EvTypeInputCopyBuilder scale(Double factor) {
setCapex(getCapex().multiply(factor));
setsRated(getsRated().multiply(factor));
seteStorage(geteStorage().multiply(factor));
seteCons(geteCons().multiply(factor));
setsRatedDC(getsRatedDC().multiply(factor));
return this;
}
@Override
public EvTypeInput build() {
return new EvTypeInput(
getUuid(),
getId(),
getCapex(),
getOpex(),
eStorage,
eCons,
getsRated(),
getCosPhiRated(),
getsRatedDC());
}
@Override
protected EvTypeInput.EvTypeInputCopyBuilder thisInstance() {
return this;
}
}
}