-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into ms/#827-use-java-streams-on-sql-fetsches-effe…
…ctively
- Loading branch information
Showing
27 changed files
with
389 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
(congestion-result)= | ||
|
||
# Congestion | ||
|
||
Representation of a congestion result for a given subnet. | ||
|
||
## Attributes, Units and Remarks | ||
|
||
```{eval-rst} | ||
.. list-table:: | ||
:widths: 33 33 33 | ||
:header-rows: 1 | ||
* - Attribute | ||
- Unit | ||
- Remarks | ||
* - time | ||
- ZonedDateTime | ||
- date and time for the produced result | ||
* - subgrid | ||
- -- | ||
- Sub grid number | ||
* - vMin | ||
- p.u. | ||
- minimal voltage of the subnet | ||
* - vMax | ||
- p.u. | ||
- maximal voltage of the subnet | ||
* - voltage | ||
- -- | ||
- Boolean indicator, if a voltage congestion occurred | ||
* - line | ||
- -- | ||
- Boolean indicator, if a line congestion occurred | ||
* - transformer | ||
- -- | ||
- Boolean indicator, if a transformer congestion occurred | ||
``` | ||
|
||
## Caveats | ||
|
||
Nothing - at least not known. | ||
If you found something, please contact us! |
52 changes: 52 additions & 0 deletions
52
src/main/java/edu/ie3/datamodel/io/factory/result/CongestionResultFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* © 2024. TU Dortmund University, | ||
* Institute of Energy Systems, Energy Efficiency and Energy Economics, | ||
* Research group Distribution grid planning and operation | ||
*/ | ||
package edu.ie3.datamodel.io.factory.result; | ||
|
||
import static edu.ie3.util.quantities.PowerSystemUnits.PU; | ||
|
||
import edu.ie3.datamodel.io.factory.EntityData; | ||
import edu.ie3.datamodel.models.result.CongestionResult; | ||
import java.time.ZonedDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.List; | ||
import java.util.Set; | ||
import javax.measure.quantity.Dimensionless; | ||
import tech.units.indriya.ComparableQuantity; | ||
|
||
public class CongestionResultFactory extends ResultEntityFactory<CongestionResult> { | ||
private static final String SUBGRID = "subgrid"; | ||
private static final String VMIN = "vMin"; | ||
private static final String VMAX = "vMax"; | ||
private static final String VOLTAGE = "voltage"; | ||
private static final String LINE = "line"; | ||
private static final String TRANSFORMER = "transformer"; | ||
|
||
public CongestionResultFactory() { | ||
super(CongestionResult.class); | ||
} | ||
|
||
public CongestionResultFactory(DateTimeFormatter dateTimeFormatter) { | ||
super(dateTimeFormatter, CongestionResult.class); | ||
} | ||
|
||
@Override | ||
protected List<Set<String>> getFields(Class<?> entityClass) { | ||
return List.of(newSet(TIME, SUBGRID, VMIN, VMAX, VOLTAGE, LINE, TRANSFORMER)); | ||
} | ||
|
||
@Override | ||
protected CongestionResult buildModel(EntityData data) { | ||
ZonedDateTime zdtTime = timeUtil.toZonedDateTime(data.getField(TIME)); | ||
int subgrid = data.getInt(SUBGRID); | ||
ComparableQuantity<Dimensionless> vMin = data.getQuantity(VMIN, PU); | ||
ComparableQuantity<Dimensionless> vMax = data.getQuantity(VMAX, PU); | ||
boolean voltage = data.getBoolean(VOLTAGE); | ||
boolean line = data.getBoolean(LINE); | ||
boolean transformer = data.getBoolean(TRANSFORMER); | ||
|
||
return new CongestionResult(zdtTime, subgrid, vMin, vMax, voltage, line, transformer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/edu/ie3/datamodel/io/factory/result/ModelResultFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* © 2024. TU Dortmund University, | ||
* Institute of Energy Systems, Energy Efficiency and Energy Economics, | ||
* Research group Distribution grid planning and operation | ||
*/ | ||
package edu.ie3.datamodel.io.factory.result; | ||
|
||
import edu.ie3.datamodel.models.result.ModelResultEntity; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public abstract class ModelResultFactory<T extends ModelResultEntity> | ||
extends ResultEntityFactory<T> { | ||
protected static final String INPUT_MODEL = "inputModel"; | ||
|
||
protected ModelResultFactory(Class<? extends T>... allowedClasses) { | ||
super(allowedClasses); | ||
} | ||
|
||
protected ModelResultFactory( | ||
DateTimeFormatter dateTimeFormatter, Class<? extends T>... allowedClasses) { | ||
super(dateTimeFormatter, allowedClasses); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
src/main/java/edu/ie3/datamodel/models/result/CongestionResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* © 2024. TU Dortmund University, | ||
* Institute of Energy Systems, Energy Efficiency and Energy Economics, | ||
* Research group Distribution grid planning and operation | ||
*/ | ||
package edu.ie3.datamodel.models.result; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.Objects; | ||
import javax.measure.quantity.Dimensionless; | ||
import tech.units.indriya.ComparableQuantity; | ||
|
||
public class CongestionResult extends ResultEntity { | ||
/** Values */ | ||
private final Integer subgrid; | ||
|
||
private final ComparableQuantity<Dimensionless> vMin; | ||
private final ComparableQuantity<Dimensionless> vMax; | ||
private final boolean voltage; | ||
private final boolean line; | ||
private final boolean transformer; | ||
|
||
/** | ||
* Standard constructor which includes auto generation of the resulting output models uuid. | ||
* | ||
* @param time date and time when the result is produced | ||
* @param subgrid the subgrid | ||
* @param vMin minimum voltage in pu | ||
* @param vMax maximal voltage in pu | ||
* @param voltage {@code true} if a voltage congestion occurred in the subnet | ||
* @param line {@code true} if a line congestion occurred in the subnet | ||
* @param transformer {@code true} if a transformer congestion occurred in the subnet | ||
*/ | ||
public CongestionResult( | ||
ZonedDateTime time, | ||
int subgrid, | ||
ComparableQuantity<Dimensionless> vMin, | ||
ComparableQuantity<Dimensionless> vMax, | ||
boolean voltage, | ||
boolean line, | ||
boolean transformer) { | ||
super(time); | ||
this.subgrid = subgrid; | ||
this.vMin = vMin; | ||
this.vMax = vMax; | ||
this.voltage = voltage; | ||
this.line = line; | ||
this.transformer = transformer; | ||
} | ||
|
||
public int getSubgrid() { | ||
return subgrid; | ||
} | ||
|
||
public boolean getVoltage() { | ||
return voltage; | ||
} | ||
|
||
public boolean getLine() { | ||
return line; | ||
} | ||
|
||
public boolean getTransformer() { | ||
return transformer; | ||
} | ||
|
||
public ComparableQuantity<Dimensionless> getVMin() { | ||
return vMin; | ||
} | ||
|
||
public ComparableQuantity<Dimensionless> getVMax() { | ||
return vMax; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
CongestionResult that = (CongestionResult) o; | ||
return getTime().equals(that.getTime()) | ||
&& Objects.equals(subgrid, that.subgrid) | ||
&& vMin.equals(that.vMin) | ||
&& vMax.equals(that.vMax) | ||
&& voltage == that.voltage | ||
&& line == that.line | ||
&& transformer == that.transformer; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash( | ||
super.hashCode(), getTime(), subgrid, vMin, vMax, voltage, line, transformer); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "InputResultEntity{time=" | ||
+ getTime() | ||
+ ", subgrid=" | ||
+ subgrid | ||
+ ", vMin=" | ||
+ vMin | ||
+ ", vMan=" | ||
+ vMax | ||
+ ", voltage=" | ||
+ voltage | ||
+ ", line=" | ||
+ line | ||
+ ", transformer=" | ||
+ transformer | ||
+ '}'; | ||
} | ||
} |
Oops, something went wrong.