Skip to content

Commit ad6f7e9

Browse files
committed
Implementing requested changes.
1 parent 4dda656 commit ad6f7e9

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

docs/readthedocs/models/result/grid/congestion.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Representation of a congestion result for a given subnet.
1919
* - time
2020
- ZonedDateTime
2121
- date and time for the produced result
22+
23+
* - subgrid
24+
- --
25+
- Sub grid number
2226
2327
* - vMin
2428
- p.u.

src/main/java/edu/ie3/datamodel/io/factory/result/CongestionResultFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import tech.units.indriya.ComparableQuantity;
1818

1919
public class CongestionResultFactory extends ResultEntityFactory<CongestionResult> {
20-
private static final String SUBNET = "subnet";
20+
private static final String SUBGRID = "subgrid";
2121
private static final String VMIN = "vMin";
2222
private static final String VMAX = "vMax";
2323
private static final String VOLTAGE = "voltage";
@@ -34,13 +34,13 @@ public CongestionResultFactory(DateTimeFormatter dateTimeFormatter) {
3434

3535
@Override
3636
protected List<Set<String>> getFields(Class<?> entityClass) {
37-
return List.of(newSet(TIME, SUBNET, VMIN, VMAX, VOLTAGE, LINE, TRANSFORMER));
37+
return List.of(newSet(TIME, SUBGRID, VMIN, VMAX, VOLTAGE, LINE, TRANSFORMER));
3838
}
3939

4040
@Override
4141
protected CongestionResult buildModel(EntityData data) {
4242
ZonedDateTime zdtTime = timeUtil.toZonedDateTime(data.getField(TIME));
43-
int subnet = data.getInt(SUBNET);
43+
int subnet = data.getInt(SUBGRID);
4444
ComparableQuantity<Dimensionless> vMin = data.getQuantity(VMIN, PU);
4545
ComparableQuantity<Dimensionless> vMax = data.getQuantity(VMAX, PU);
4646
boolean voltage = data.getBoolean(VOLTAGE);

src/main/java/edu/ie3/datamodel/models/result/CongestionResult.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
public class CongestionResult extends ResultEntity {
1414
/** Values */
15-
private final Integer subnet;
15+
private final Integer subgrid;
1616

1717
private final ComparableQuantity<Dimensionless> vMin;
1818
private final ComparableQuantity<Dimensionless> vMax;
@@ -24,7 +24,7 @@ public class CongestionResult extends ResultEntity {
2424
* Standard constructor which includes auto generation of the resulting output models uuid.
2525
*
2626
* @param time date and time when the result is produced
27-
* @param subnet the subnet
27+
* @param subgrid the subgrid
2828
* @param vMin minimum voltage in pu
2929
* @param vMax maximal voltage in pu
3030
* @param voltage {@code true} if a voltage congestion occurred in the subnet
@@ -33,23 +33,23 @@ public class CongestionResult extends ResultEntity {
3333
*/
3434
public CongestionResult(
3535
ZonedDateTime time,
36-
int subnet,
36+
int subgrid,
3737
ComparableQuantity<Dimensionless> vMin,
3838
ComparableQuantity<Dimensionless> vMax,
3939
boolean voltage,
4040
boolean line,
4141
boolean transformer) {
4242
super(time);
43-
this.subnet = subnet;
43+
this.subgrid = subgrid;
4444
this.vMin = vMin;
4545
this.vMax = vMax;
4646
this.voltage = voltage;
4747
this.line = line;
4848
this.transformer = transformer;
4949
}
5050

51-
public int getSubnet() {
52-
return subnet;
51+
public int getSubgrid() {
52+
return subgrid;
5353
}
5454

5555
public boolean getVoltage() {
@@ -78,6 +78,7 @@ public boolean equals(Object o) {
7878
if (o == null || getClass() != o.getClass()) return false;
7979
CongestionResult that = (CongestionResult) o;
8080
return getTime().equals(that.getTime())
81+
&& Objects.equals(subgrid, that.subgrid)
8182
&& vMin.equals(that.vMin)
8283
&& vMax.equals(that.vMax)
8384
&& voltage == that.voltage
@@ -87,13 +88,16 @@ public boolean equals(Object o) {
8788

8889
@Override
8990
public int hashCode() {
90-
return Objects.hash(super.hashCode(), getTime(), vMin, vMax, voltage, line, transformer);
91+
return Objects.hash(
92+
super.hashCode(), getTime(), subgrid, vMin, vMax, voltage, line, transformer);
9193
}
9294

9395
@Override
9496
public String toString() {
9597
return "InputResultEntity{time="
9698
+ getTime()
99+
+ ", subgrid="
100+
+ subgrid
97101
+ ", vMin="
98102
+ vMin
99103
+ ", vMan="

src/main/java/edu/ie3/datamodel/utils/validation/UniquenessValidationUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import edu.ie3.datamodel.models.input.IdCoordinateInput;
1414
import edu.ie3.datamodel.models.result.CongestionResult;
1515
import edu.ie3.datamodel.models.result.ModelResultEntity;
16-
import edu.ie3.datamodel.models.result.ResultEntity;
1716
import edu.ie3.datamodel.models.timeseries.individual.TimeBasedValue;
1817
import edu.ie3.datamodel.models.value.WeatherValue;
1918
import edu.ie3.datamodel.utils.Try;
@@ -32,7 +31,7 @@ public class UniquenessValidationUtils extends ValidationUtils {
3231
protected static final FieldSetSupplier<ModelResultEntity> modelResultFieldSupplier =
3332
entity -> Set.of(entity.getTime(), entity.getInputModel());
3433
protected static final FieldSetSupplier<CongestionResult> congestionResultFieldSupplier =
35-
entity -> Set.of(entity.getTime(), entity.getSubnet());
34+
entity -> Set.of(entity.getTime(), entity.getSubgrid());
3635
protected static final FieldSetSupplier<MappingEntry> mappingFieldSupplier =
3736
entity -> Set.of(entity.participant());
3837
protected static final FieldSetSupplier<IdCoordinateInput> idCoordinateSupplier =
@@ -73,7 +72,7 @@ public static void checkAssetUniqueness(Collection<? extends AssetInput> entitie
7372
}
7473

7574
/**
76-
* Checks the uniqueness of a collection of {@link ResultEntity}.
75+
* Checks the uniqueness of a collection of {@link CongestionResult}.
7776
*
7877
* @param entities to be checked
7978
* @throws DuplicateEntitiesException if uniqueness is violated

0 commit comments

Comments
 (0)