Skip to content

Commit

Permalink
Misleading parameter name 'height' has changed to 'elevationAngle' (#443
Browse files Browse the repository at this point in the history
)

* mh/#393-Misleading parameter name 'height' has changed to 'elevationAngle' in PvInput

* fix formatting

* fix variable height to elevationAngle in PvInputTest.groovy

* fix variable height to elevationAngle in some classes

* fix variable height to elevationAngle in PvInputFactoryTest.groovy

* fix variable height to elevationAngle in PvInputFactory and Test

* fix variable height to elevationAngle in PvInputFactory and Test

* fix variable height to elevationAngle in pv_input
 and CsvSystemParticipantSourceTest

* fix variable height to elevationAngle in PvInputFactoryTest.groovy

* Adapting tests to refactored field

* Add changed name of parameter height to elevationAngle to Changelog

* More related refactoring in comments and tests

Co-authored-by: Chris Kittl <44838605+ckittl@users.noreply.github.com>
Co-authored-by: t-ober <63147366+t-ober@users.noreply.github.com>
Co-authored-by: Sebastian Peter <14994800+sebastian-peter@users.noreply.github.com>
Co-authored-by: danielfeismann <daniel.feismann@tu-dortmund.de>
Co-authored-by: Sebastian Peter <sebastian.peter@tu-dortmund.de>
  • Loading branch information
6 people committed Mar 3, 2022
1 parent 605898f commit 8ebb413
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 49 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Let JavDoc pass, if there are warnings **ATTENTION:** Should be removed, when JavaDoc is fixed! (cf. Issue [#494](https://github.com/ie3-institute/PowerSystemDataModel/issues/494))

### Changed
- BREAKING: PvInput Model parameter name height changed to elevationAngle [#393](https://github.com/ie3-institute/PowerSystemDataModel/issues/393) :warning:
- BREAKING: Transformer's no load susceptance needs to be zero or negative to pass model validation [#378](https://github.com/ie3-institute/PowerSystemDataModel/issues/378)
- All input data sets for version < 3.0.0 need to be altered!
- Deprecating (as part of [#513](https://github.com/ie3-institute/PowerSystemDataModel/issues/513)):
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/models/input/participant/pv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Detailed model of a photovoltaic power plant.
+------------------+---------+--------------------------------------------------------------------------------------+
| etaConv | % | Efficiency of the assets inverter |
+------------------+---------+--------------------------------------------------------------------------------------+
| height | ° | Tilted inclination from horizontal [0°, 90°] |
| elevationAngle | ° | Tilted inclination from horizontal [0°, 90°] |
+------------------+---------+--------------------------------------------------------------------------------------+
| kG | -- | Generator correction factor merging technical influences |
+------------------+---------+--------------------------------------------------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion docs/uml/main/input/SystemDatamodelConcept.puml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ package models {
- albedo: Double
- azimuth: ComparableQuantity<Angle> [°]
- etaConv: ComparableQuantity<Dimensionless> [%]
- height: ComparableQuantity<Angle> [°]
- elevationAngle: ComparableQuantity<Angle> [°]
- kG: Double
- kT: Double
- marketReaction: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PvInputFactory
private static final String ALBEDO = "albedo";
private static final String AZIMUTH = "azimuth";
private static final String ETA_CONV = "etaconv";
private static final String HEIGHT = "height";
private static final String ELEVATION_ANGLE = "elevationangle";
private static final String KG = "kg";
private static final String KT = "kt";
private static final String MARKET_REACTION = "marketreaction";
Expand All @@ -36,7 +36,7 @@ public PvInputFactory() {
@Override
protected String[] getAdditionalFields() {
return new String[] {
ALBEDO, AZIMUTH, ETA_CONV, HEIGHT, KG, KT, MARKET_REACTION, S_RATED, COS_PHI_RATED
ALBEDO, AZIMUTH, ETA_CONV, ELEVATION_ANGLE, KG, KT, MARKET_REACTION, S_RATED, COS_PHI_RATED
};
}

Expand All @@ -53,7 +53,8 @@ protected PvInput buildModel(
final ComparableQuantity<Angle> azimuth = data.getQuantity(AZIMUTH, StandardUnits.AZIMUTH);
final ComparableQuantity<Dimensionless> etaConv =
data.getQuantity(ETA_CONV, StandardUnits.EFFICIENCY);
final ComparableQuantity<Angle> height = data.getQuantity(HEIGHT, StandardUnits.SOLAR_HEIGHT);
final ComparableQuantity<Angle> elevationAngle =
data.getQuantity(ELEVATION_ANGLE, StandardUnits.SOLAR_ELEVATION_ANGLE);
final double kG = data.getDouble(KG);
final double kT = data.getDouble(KT);
final boolean marketReaction = data.getBoolean(MARKET_REACTION);
Expand All @@ -70,7 +71,7 @@ protected PvInput buildModel(
albedo,
azimuth,
etaConv,
height,
elevationAngle,
kG,
kT,
marketReaction,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/ie3/datamodel/models/StandardUnits.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class StandardUnits {
/** Orientation of a pv panel with regard to the north-south line in degree_geom */
public static final Unit<Angle> AZIMUTH = DEGREE_GEOM;
/** Elevation of a pv panel with regard to the plane in degree_geom */
public static final Unit<Angle> SOLAR_HEIGHT = DEGREE_GEOM;
public static final Unit<Angle> SOLAR_ELEVATION_ANGLE = DEGREE_GEOM;
/** Direction of the wind in degree geom */
public static final Unit<Angle> WIND_DIRECTION = DEGREE_GEOM;
/** Velocity of the wind in metre per second */
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/edu/ie3/datamodel/models/input/system/PvInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class PvInput extends SystemParticipantInput {
/** Efficiency of converter (typically in %) */
private final ComparableQuantity<Dimensionless> etaConv;
/** Tilted inclination from horizontal (typically in °) */
private final ComparableQuantity<Angle> height;
private final ComparableQuantity<Angle> elevationAngle;
/** Generator correction factor merging different technical influences */
private final double kG;
/** Temperature correction factor */
Expand All @@ -51,7 +51,7 @@ public class PvInput extends SystemParticipantInput {
* @param albedo Albedo value (typically a value between 0 and 1)
* @param azimuth Inclination in a compass direction (typically °: South 0◦; West 90◦; East -90◦)
* @param etaConv Efficiency of converter (typically in %)
* @param height Tilted inclination from horizontal (typically in °)
* @param elevationAngle Tilted inclination from horizontal (typically in °)
* @param kG Generator correction factor merging different technical influences
* @param kT Generator correction factor merging different technical influences
* @param marketReaction Is this asset market oriented?
Expand All @@ -68,7 +68,7 @@ public PvInput(
double albedo,
ComparableQuantity<Angle> azimuth,
ComparableQuantity<Dimensionless> etaConv,
ComparableQuantity<Angle> height,
ComparableQuantity<Angle> elevationAngle,
double kG,
double kT,
boolean marketReaction,
Expand All @@ -78,7 +78,7 @@ public PvInput(
this.albedo = albedo;
this.azimuth = azimuth.to(StandardUnits.AZIMUTH);
this.etaConv = etaConv.to(StandardUnits.EFFICIENCY);
this.height = height.to(StandardUnits.SOLAR_HEIGHT);
this.elevationAngle = elevationAngle.to(StandardUnits.SOLAR_ELEVATION_ANGLE);
this.kG = kG;
this.kT = kT;
this.marketReaction = marketReaction;
Expand All @@ -96,7 +96,7 @@ public PvInput(
* @param albedo Albedo value (typically a value between 0 and 1)
* @param azimuth Inclination in a compass direction (typically °: South 0◦; West 90◦; East -90◦)
* @param etaConv Efficiency of converter (typically in %)
* @param height Tilted inclination from horizontal (typically in °)
* @param elevationAngle Tilted inclination from horizontal (typically in °)
* @param kG Generator correction factor merging different technical influences
* @param kT Generator correction factor merging different technical influences
* @param marketReaction Is this asset market oriented?
Expand All @@ -111,7 +111,7 @@ public PvInput(
double albedo,
ComparableQuantity<Angle> azimuth,
ComparableQuantity<Dimensionless> etaConv,
ComparableQuantity<Angle> height,
ComparableQuantity<Angle> elevationAngle,
double kG,
double kT,
boolean marketReaction,
Expand All @@ -121,7 +121,7 @@ public PvInput(
this.albedo = albedo;
this.azimuth = azimuth.to(StandardUnits.AZIMUTH);
this.etaConv = etaConv.to(StandardUnits.EFFICIENCY);
this.height = height.to(StandardUnits.SOLAR_HEIGHT);
this.elevationAngle = elevationAngle.to(StandardUnits.SOLAR_ELEVATION_ANGLE);
this.kG = kG;
this.kT = kT;
this.marketReaction = marketReaction;
Expand All @@ -141,8 +141,8 @@ public ComparableQuantity<Dimensionless> getEtaConv() {
return etaConv;
}

public ComparableQuantity<Angle> getHeight() {
return height;
public ComparableQuantity<Angle> getElevationAngle() {
return elevationAngle;
}

public boolean isMarketReaction() {
Expand Down Expand Up @@ -181,7 +181,7 @@ public boolean equals(Object o) {
&& Double.compare(pvInput.cosPhiRated, cosPhiRated) == 0
&& azimuth.equals(pvInput.azimuth)
&& etaConv.equals(pvInput.etaConv)
&& height.equals(pvInput.height)
&& elevationAngle.equals(pvInput.elevationAngle)
&& sRated.equals(pvInput.sRated);
}

Expand All @@ -192,7 +192,7 @@ public int hashCode() {
albedo,
azimuth,
etaConv,
height,
elevationAngle,
kG,
kT,
marketReaction,
Expand Down Expand Up @@ -222,8 +222,8 @@ public String toString() {
+ azimuth
+ ", etaConv="
+ etaConv
+ ", height="
+ height
+ ", elevationAngle="
+ elevationAngle
+ ", kG="
+ kG
+ ", kT="
Expand All @@ -250,7 +250,7 @@ public static class PvInputCopyBuilder
private double albedo;
private ComparableQuantity<Angle> azimuth;
private ComparableQuantity<Dimensionless> etaConv;
private ComparableQuantity<Angle> height;
private ComparableQuantity<Angle> elevationAngle;
private double kG;
private double kT;
private boolean marketReaction;
Expand All @@ -262,7 +262,7 @@ public PvInputCopyBuilder(PvInput entity) {
this.albedo = entity.getAlbedo();
this.azimuth = entity.getAzimuth();
this.etaConv = entity.getEtaConv();
this.height = entity.getHeight();
this.elevationAngle = entity.getElevationAngle();
this.kG = entity.getkG();
this.kT = entity.getkT();
this.marketReaction = entity.isMarketReaction();
Expand All @@ -285,8 +285,8 @@ public PvInputCopyBuilder etaConv(ComparableQuantity<Dimensionless> etaConv) {
return this;
}

public PvInputCopyBuilder height(ComparableQuantity<Angle> height) {
this.height = height;
public PvInputCopyBuilder elevationAngle(ComparableQuantity<Angle> elevationAngle) {
this.elevationAngle = elevationAngle;
return this;
}

Expand Down Expand Up @@ -327,7 +327,7 @@ public PvInput build() {
albedo,
azimuth,
etaConv,
height,
elevationAngle,
kG,
kT,
marketReaction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ private static void checkLoad(LoadInput loadInput) {
* Validates a PvInput if: <br>
* - its rated apparent power is not negative <br>
* - its albedo value of the plant's surrounding is between 0 and 1 <br>
* - its inclination in a compass direction (azimuth) is is between -90° and 90° <br>
* - its efficiency of the asset's inverter (etaConv) is is between 0% and 100% <br>
* - its tilted inclination from horizontal (height) is is between 0° and 90° <br>
* - its inclination in a compass direction (azimuth) is between -90° and 90° <br>
* - its efficiency of the asset's inverter (etaConv) is between 0% and 100% <br>
* - its tilted inclination from horizontal (elevation angle) is between 0° and 90° <br>
* - its rated power factor is between 0 and 1
*
* @param pvInput PvInput to validate
Expand All @@ -250,7 +250,7 @@ private static void checkPv(PvInput pvInput) {
checkAlbedo(pvInput);
checkAzimuth(pvInput);
isBetweenZeroAndHundredPercent(pvInput, pvInput.getEtaConv(), "Efficiency of the converter");
checkHeight(pvInput);
checkElevationAngle(pvInput);
checkRatedPowerFactor(pvInput, pvInput.getCosPhiRated());
}

Expand Down Expand Up @@ -288,9 +288,11 @@ private static void checkAzimuth(PvInput pvInput) {
*
* @param pvInput PvInput to validate
*/
private static void checkHeight(PvInput pvInput) {
if (pvInput.getHeight().isLessThan(Quantities.getQuantity(0d, SOLAR_HEIGHT))
|| pvInput.getHeight().isGreaterThan(Quantities.getQuantity(90d, SOLAR_HEIGHT)))
private static void checkElevationAngle(PvInput pvInput) {
if (pvInput.getElevationAngle().isLessThan(Quantities.getQuantity(0d, SOLAR_ELEVATION_ANGLE))
|| pvInput
.getElevationAngle()
.isGreaterThan(Quantities.getQuantity(90d, SOLAR_ELEVATION_ANGLE)))
throw new InvalidEntityException(
"Tilted inclination from horizontal of "
+ pvInput.getClass().getSimpleName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PvInputFactoryTest extends Specification implements FactoryTestHelper {
"albedo" : "3",
"azimuth" : "4",
"etaconv" : "5",
"height" : "6",
"elevationangle" : "6",
"kg" : "7",
"kt" : "8",
"marketreaction" : "true",
Expand Down Expand Up @@ -78,7 +78,7 @@ class PvInputFactoryTest extends Specification implements FactoryTestHelper {
assert albedo == Double.parseDouble(parameter["albedo"])
assert azimuth == getQuant(parameter["azimuth"], StandardUnits.AZIMUTH)
assert etaConv == getQuant(parameter["etaconv"], StandardUnits.EFFICIENCY)
assert height == getQuant(parameter["height"], StandardUnits.SOLAR_HEIGHT)
assert elevationAngle == getQuant(parameter["elevationangle"], StandardUnits.SOLAR_ELEVATION_ANGLE)
assert kG == Double.parseDouble(parameter["kg"])
assert kT == Double.parseDouble(parameter["kt"])
assert marketReaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class InputEntityProcessorTest extends Specification {
"azimuth" : SystemParticipantTestData.pvInput.azimuth.to(StandardUnits.AZIMUTH).getValue().doubleValue().toString(),
"cosPhiRated" : SystemParticipantTestData.pvInput.cosPhiRated.toString(),
"etaConv" : SystemParticipantTestData.pvInput.etaConv.getValue().doubleValue().toString(),
"height" : SystemParticipantTestData.pvInput.height.getValue().doubleValue().toString(),
"elevationAngle" : SystemParticipantTestData.pvInput.elevationAngle.getValue().doubleValue().toString(),
"id" : SystemParticipantTestData.pvInput.id,
"kG" : SystemParticipantTestData.pvInput.kG.toString(),
"kT" : SystemParticipantTestData.pvInput.kT.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class CsvSystemParticipantSourceTest extends Specification implements CsvTestDat
nodes | operators || resultingSize || resultingSet
[sptd.pvInput.node]| [sptd.pvInput.operator]|| 1 || [sptd.pvInput]
[sptd.pvInput.node]| []|| 1 || [
new PvInput(sptd.pvInput.uuid, sptd.pvInput.id, OperatorInput.NO_OPERATOR_ASSIGNED, sptd.pvInput.operationTime, sptd.pvInput.node, sptd.pvInput.qCharacteristics, sptd.pvInput.albedo, sptd.pvInput.azimuth, sptd.pvInput.etaConv, sptd.pvInput.height, sptd.pvInput.kG, sptd.pvInput.kT, sptd.pvInput.marketReaction, sptd.pvInput.sRated, sptd.pvInput.cosPhiRated)
new PvInput(sptd.pvInput.uuid, sptd.pvInput.id, OperatorInput.NO_OPERATOR_ASSIGNED, sptd.pvInput.operationTime, sptd.pvInput.node, sptd.pvInput.qCharacteristics, sptd.pvInput.albedo, sptd.pvInput.azimuth, sptd.pvInput.etaConv, sptd.pvInput.elevationAngle, sptd.pvInput.kG, sptd.pvInput.kT, sptd.pvInput.marketReaction, sptd.pvInput.sRated, sptd.pvInput.cosPhiRated)
]
[]| [sptd.pvInput.operator]|| 0 || []
[]| []|| 0 || []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PvInputTest extends Specification {
def pvInput = SystemParticipantTestData.pvInput

when:
def alteredUnit = pvInput.copy().albedo(10).azimuth(Quantities.getQuantity(10, DEGREE_GEOM)).height(Quantities.getQuantity(50, DEGREE_GEOM))
def alteredUnit = pvInput.copy().albedo(10).azimuth(Quantities.getQuantity(10, DEGREE_GEOM)).elevationAngle(Quantities.getQuantity(50, DEGREE_GEOM))
.etaConv(Quantities.getQuantity(50d, PERCENT)).kG(10).kT(5).marketReaction(true).sRated(Quantities.getQuantity(0d, KILOVOLTAMPERE))
.cosPhiRated(0.7d).build()
then:
Expand All @@ -37,7 +37,7 @@ class PvInputTest extends Specification {
assert albedo == 10
assert azimuth == Quantities.getQuantity(10, DEGREE_GEOM)
assert etaConv == Quantities.getQuantity(50, PERCENT)
assert height == Quantities.getQuantity(50, DEGREE_GEOM)
assert elevationAngle == Quantities.getQuantity(50, DEGREE_GEOM)
assert kG == 10
assert kT == 5
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,13 @@ class SystemParticipantValidationUtilsTest extends Specification {
ex.message == expectedException.message

where:
invalidPV || expectedException
SystemParticipantTestData.pvInput.copy().sRated(Quantities.getQuantity(-25d, ACTIVE_POWER_IN)).build() || new InvalidEntityException("The following quantities have to be zero or positive: -25 kVA", invalidPV)
SystemParticipantTestData.pvInput.copy().albedo(2).build() || new InvalidEntityException("Albedo of the plant's surrounding of PvInput must be between 0 and 1", invalidPV)
SystemParticipantTestData.pvInput.copy().azimuth(Quantities.getQuantity(-100d, AZIMUTH)).build() || new InvalidEntityException("Azimuth angle of PvInput must be between -90° (east) and 90° (west)", invalidPV)
SystemParticipantTestData.pvInput.copy().etaConv(Quantities.getQuantity(110d, EFFICIENCY)).build() || new InvalidEntityException("Efficiency of the converter of PvInput must be between 0% and 100%", invalidPV)
SystemParticipantTestData.pvInput.copy().height(Quantities.getQuantity(100d, SOLAR_HEIGHT)).build() || new InvalidEntityException("Tilted inclination from horizontal of PvInput must be between 0° and 90°", invalidPV)
SystemParticipantTestData.pvInput.copy().cosPhiRated(2).build() || new InvalidEntityException("Rated power factor of PvInput must be between 0 and 1", invalidPV)
invalidPV || expectedException
SystemParticipantTestData.pvInput.copy().sRated(Quantities.getQuantity(-25d, ACTIVE_POWER_IN)).build() || new InvalidEntityException("The following quantities have to be zero or positive: -25 kVA", invalidPV)
SystemParticipantTestData.pvInput.copy().albedo(2).build() || new InvalidEntityException("Albedo of the plant's surrounding of PvInput must be between 0 and 1", invalidPV)
SystemParticipantTestData.pvInput.copy().azimuth(Quantities.getQuantity(-100d, AZIMUTH)).build() || new InvalidEntityException("Azimuth angle of PvInput must be between -90° (east) and 90° (west)", invalidPV)
SystemParticipantTestData.pvInput.copy().etaConv(Quantities.getQuantity(110d, EFFICIENCY)).build() || new InvalidEntityException("Efficiency of the converter of PvInput must be between 0% and 100%", invalidPV)
SystemParticipantTestData.pvInput.copy().elevationAngle(Quantities.getQuantity(100d, SOLAR_ELEVATION_ANGLE)).build() || new InvalidEntityException("Tilted inclination from horizontal of PvInput must be between 0° and 90°", invalidPV)
SystemParticipantTestData.pvInput.copy().cosPhiRated(2).build() || new InvalidEntityException("Rated power factor of PvInput must be between 0 and 1", invalidPV)
}

// Storage
Expand Down
2 changes: 1 addition & 1 deletion src/test/groovy/edu/ie3/test/common/SampleJointGrid.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class SampleJointGrid extends SystemParticipantTestData {
SystemParticipantTestData.albedo,
SystemParticipantTestData.azimuth,
SystemParticipantTestData.etaConv,
SystemParticipantTestData.height,
SystemParticipantTestData.elevationAngle,
SystemParticipantTestData.kG,
SystemParticipantTestData.kT,
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SystemParticipantTestData {
// PV
private static final double albedo = 0.20000000298023224d
private static final ComparableQuantity<Angle> azimuth = Quantities.getQuantity(-8.926613807678223d, AZIMUTH)
private static final ComparableQuantity<Angle> height = Quantities.getQuantity(41.01871871948242d, SOLAR_HEIGHT)
private static final ComparableQuantity<Angle> elevationAngle = Quantities.getQuantity(41.01871871948242d, SOLAR_ELEVATION_ANGLE)
private static double kT = 1d
private static double kG = 0.8999999761581421d
public static final PvInput pvInput = new PvInput(
Expand All @@ -84,7 +84,7 @@ class SystemParticipantTestData {
albedo,
azimuth,
etaConv,
height,
elevationAngle,
kG,
kT,
false,
Expand Down

0 comments on commit 8ebb413

Please sign in to comment.