-
Notifications
You must be signed in to change notification settings - Fork 7
Adding a timeseries for voltage values. #1130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
956d81a
Adding a timeseries for voltage values.
staudtMarius 5bfa184
Merge branch 'dev' into ms/#1128-adding-voltage-timeseries
staudtMarius 3d30927
Adding information to docs.
staudtMarius 241ef3c
Merge branch 'dev' into ms/#1128-adding-voltage-timeseries
staudtMarius 61b9b7a
Simplifying code.
staudtMarius a709691
Merge branch 'dev' into ms/#1128-adding-voltage-timeseries
staudtMarius 7c7b063
Merge branch 'dev' into ms/#1128-adding-voltage-timeseries
staudtMarius 1486d79
Merge branch 'dev' into ms/#1128-adding-voltage-timeseries
staudtMarius f4a042a
Removing column renaming.
staudtMarius ba5f2b3
Merge branch 'dev' into ms/#1128-adding-voltage-timeseries
staudtMarius f88d124
Implementing reviewer's requests.
staudtMarius 99312f7
Implementing reviewer's requests.
staudtMarius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
89 changes: 89 additions & 0 deletions
89
src/main/java/edu/ie3/datamodel/models/value/VoltageValue.java
This file contains hidden or 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,89 @@ | ||
| /* | ||
| * © 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.value; | ||
|
|
||
| import static edu.ie3.datamodel.models.StandardUnits.VOLTAGE_ANGLE; | ||
| import static edu.ie3.util.quantities.PowerSystemUnits.DEGREE_GEOM; | ||
| import static edu.ie3.util.quantities.PowerSystemUnits.PU; | ||
| import static java.lang.Math.*; | ||
|
|
||
| import java.util.Objects; | ||
| import java.util.Optional; | ||
| import javax.measure.quantity.Angle; | ||
| import javax.measure.quantity.Dimensionless; | ||
| import tech.units.indriya.ComparableQuantity; | ||
| import tech.units.indriya.quantity.Quantities; | ||
|
|
||
| /** Describes a voltage value as a pair of magnitude and angle */ | ||
| public class VoltageValue implements Value { | ||
|
|
||
| /** Magnitude of the voltage in p.u. */ | ||
| private final ComparableQuantity<Dimensionless> magnitude; | ||
| /** Angle of the voltage in degree */ | ||
| private final ComparableQuantity<Angle> angle; | ||
|
|
||
| /** | ||
| * @param magnitude of the voltage in p.u. | ||
| * @param angle of the voltage in degree | ||
| */ | ||
| public VoltageValue( | ||
| ComparableQuantity<Dimensionless> magnitude, ComparableQuantity<Angle> angle) { | ||
| this.magnitude = magnitude; | ||
| this.angle = angle; | ||
| } | ||
|
|
||
| /** | ||
| * This constructor will set the angle to 0° | ||
| * | ||
| * @param magnitude of the voltage in p.u. | ||
| */ | ||
| public VoltageValue(ComparableQuantity<Dimensionless> magnitude) { | ||
| this.magnitude = magnitude; | ||
| this.angle = Quantities.getQuantity(0.0, VOLTAGE_ANGLE); | ||
| } | ||
|
|
||
| public Optional<ComparableQuantity<Dimensionless>> getMagnitude() { | ||
| return Optional.ofNullable(magnitude); | ||
| } | ||
|
|
||
| public Optional<ComparableQuantity<Angle>> getAngle() { | ||
| return Optional.ofNullable(angle); | ||
| } | ||
|
|
||
| public Optional<ComparableQuantity<Dimensionless>> getRealPart() { | ||
| double mag = magnitude.to(PU).getValue().doubleValue(); | ||
| double ang = angle.to(DEGREE_GEOM).getValue().doubleValue(); | ||
|
|
||
| double eInPu = mag * cos(toRadians(ang)); | ||
| return Optional.of(Quantities.getQuantity(eInPu, PU)); | ||
| } | ||
|
|
||
| public Optional<ComparableQuantity<Dimensionless>> getImagPart() { | ||
| double mag = magnitude.to(PU).getValue().doubleValue(); | ||
| double ang = angle.to(DEGREE_GEOM).getValue().doubleValue(); | ||
|
|
||
| double eInPu = mag * sin(toRadians(ang)); | ||
staudtMarius marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return Optional.of(Quantities.getQuantity(eInPu, PU)); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
| if (o == null || getClass() != o.getClass()) return false; | ||
| VoltageValue that = (VoltageValue) o; | ||
| return Objects.equals(magnitude, that.magnitude) && Objects.equals(angle, that.angle); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(magnitude, angle); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "VoltageValue{" + "magnitude=" + magnitude + ", angle=" + angle + '}'; | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.