Skip to content
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

Fix Irradiation / Irradiance #268

Merged
merged 13 commits into from
Dec 18, 2020
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- added coordinate distance sort method to GridAndGeoUtils
- BREAKING: Harmonized field naming for time information
- BREAKING: Properly applying snake case to result file names
- BREAKING: Change in dimension of `Irradiation` from Energy/Area to Power/Area led to adaptions in the `StandardUnits`. `StandardUnits.IRRADIATION` is now kW/m² instead of kW**h**/m²

### Fixed
- InfluxDbConnector now keeps session instead of creating a new one each call
(resolves [#247](https://github.com/ie3-institute/PowerSystemDataModel/issues/247)
and [#248](https://github.com/ie3-institute/PowerSystemDataModel/issues/248))
- BREAKING: fix invalid application of solar irradiance / irradiation ([#266](https://github.com/ie3-institute/PowerSystemDataModel/issues/266))

## [1.1.0] - 2020-09-15

Expand Down
48 changes: 25 additions & 23 deletions docs/readthedocs/models/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,26 +189,28 @@ Repetitive Time Series
To be as flexible, as possible, the actual content of the time series is given as children of the :code:`Value` class.
The following different values are available:

+--------------------------+------------------------------------------------------------------+
| Value Class | Purpose |
+==========================+==================================================================+
| :code:`PValue` | Electrical active power |
+--------------------------+------------------------------------------------------------------+
| :code:`SValue` | Electrical active and reactive power |
+--------------------------+------------------------------------------------------------------+
| :code:`HeatAndPValue` | | Combination of thermal power (e.g. in kW) |
| | | and electrical active power (e.g. in kW) |
+--------------------------+------------------------------------------------------------------+
| :code:`HeatAndSValue` | | Combination of thermal power (e.g. in kW) |
| | | and electrical active and reactive power (e.g. in kW and kVAr) |
+--------------------------+------------------------------------------------------------------+
| :code:`EnergyPriceValue` | Wholesale market price (e.g. in € / MWh) |
+--------------------------+------------------------------------------------------------------+
| :code:`IrradiationValue` | Combination of diffuse and direct solar irradiation |
+--------------------------+------------------------------------------------------------------+
| :code:`TemperatureValue` | Temperature information |
+--------------------------+------------------------------------------------------------------+
| :code:`WindValue` | Combination of wind direction and wind velocity |
+--------------------------+------------------------------------------------------------------+
| :code:`WeatherValue` | Combination of irradiation, temperature and wind information |
+--------------------------+------------------------------------------------------------------+
+-------------------------------+------------------------------------------------------------------+
| Value Class | Purpose |
+===============================+==================================================================+
| :code:`PValue` | Electrical active power |
+-------------------------------+------------------------------------------------------------------+
| :code:`SValue` | Electrical active and reactive power |
+-------------------------------+------------------------------------------------------------------+
| :code:`HeatAndPValue` | | Combination of thermal power (e.g. in kW) |
| | | and electrical active power (e.g. in kW) |
+-------------------------------+------------------------------------------------------------------+
| :code:`HeatAndSValue` | | Combination of thermal power (e.g. in kW) |
| | | and electrical active and reactive power (e.g. in kW and kVAr) |
+-------------------------------+------------------------------------------------------------------+
| :code:`EnergyPriceValue` | Wholesale market price (e.g. in € / MWh) |
+-------------------------------+------------------------------------------------------------------+
| :code:`IrradiationValue` | Combination of diffuse and direct solar irradiation |
johanneshiry marked this conversation as resolved.
Show resolved Hide resolved
+-------------------------------+------------------------------------------------------------------+
| :code:`SolarIrradianceValue` | Combination of diffuse and direct solar irradiance |
+-------------------------------+------------------------------------------------------------------+
| :code:`TemperatureValue` | Temperature information |
+-------------------------------+------------------------------------------------------------------+
| :code:`WindValue` | Combination of wind direction and wind velocity |
+-------------------------------+------------------------------------------------------------------+
| :code:`WeatherValue` | Combination of irradiance, temperature and wind information |
+-------------------------------+------------------------------------------------------------------+
14 changes: 10 additions & 4 deletions docs/uml/main/TimeSeriesDatamodelConcept.puml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,17 @@ package models {
HeatAndSValue --|> SValue

class IrradiationValue {
johanneshiry marked this conversation as resolved.
Show resolved Hide resolved
- directIrradiation: ComparableQuantity<Irradiation> [kWh/m²]
- diffuseIrradiation: ComparableQuantity<Irradiation> [kWh/m²]
- directIrradiation: ComparableQuantity<Irradiation> [Wh/m²]
- diffuseIrradiation: ComparableQuantity<Irradiation> [Wh/m²]
}
IrradiationValue ..|> Value

class SolarIrradianceValue {
- directIrradiance: ComparableQuantity<Irradiance> [W/m²]
- diffuseIrradiance: ComparableQuantity<Irradiance> [W/m²]
}
SolarIrradianceValue ..|> Value

class TemperatureValue {
- temperature: ComparableQuantity<Temperature> [°C]
}
Expand All @@ -86,12 +92,12 @@ package models {

class WeatherValue {
- coordinate: Point
- irradiation: IrradiationValue
- solarIrradiance: SolarIrradianceValue
- temperature: TemperatureValue
- wind: WindValue
}
WeatherValue ..|> Value
WeatherValue *-- IrradiationValue
WeatherValue *-- SolarIrradianceValue
WeatherValue *-- TemperatureValue
WeatherValue *-- WindValue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import edu.ie3.datamodel.models.value.WeatherValue;
import edu.ie3.util.TimeUtil;
import edu.ie3.util.quantities.PowerSystemUnits;
import edu.ie3.util.quantities.interfaces.Irradiation;
import edu.ie3.util.quantities.interfaces.Irradiance;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
Expand All @@ -31,8 +31,8 @@ public class IconTimeBasedWeatherValueFactory extends TimeBasedWeatherValueFacto
/* Redefine the column names to meet the icon specifications */
private static final String COORDINATE = "coordinateId";
private static final String TIME = "datum";
private static final String DIFFUSE_IRRADIATION = "aswdifdS";
private static final String DIRECT_IRRADIATION = "aswdirS";
private static final String DIFFUSE_IRRADIANCE = "aswdifdS";
private static final String DIRECT_IRRADIANCE = "aswdirS";
private static final String TEMPERATURE = "t2m";
private static final String WIND_VELOCITY_U = "u131m";
private static final String WIND_VELOCITY_V = "v131m";
Expand Down Expand Up @@ -64,8 +64,8 @@ protected List<Set<String>> getFields(TimeBasedWeatherValueData data) {
Set<String> minConstructorParams =
newSet(
TIME,
DIFFUSE_IRRADIATION,
DIRECT_IRRADIATION,
DIFFUSE_IRRADIANCE,
DIRECT_IRRADIANCE,
TEMPERATURE,
WIND_VELOCITY_U,
WIND_VELOCITY_V);
Expand All @@ -74,9 +74,9 @@ protected List<Set<String>> getFields(TimeBasedWeatherValueData data) {
newSet(
"albRad",
"asobS",
DIFFUSE_IRRADIATION,
DIFFUSE_IRRADIANCE,
"aswdifuS",
DIRECT_IRRADIATION,
DIRECT_IRRADIANCE,
TEMPERATURE,
"tG",
"u10m",
Expand Down Expand Up @@ -110,12 +110,10 @@ protected TimeBasedValue<WeatherValue> buildModel(TimeBasedWeatherValueData data
Point coordinate = data.getCoordinate();
java.util.UUID uuid = data.containsKey(UUID) ? data.getUUID(UUID) : java.util.UUID.randomUUID();
ZonedDateTime time = timeUtil.toZonedDateTime(data.getField(TIME));
ComparableQuantity<Irradiation> directIrradiation =
data.getQuantity(DIRECT_IRRADIATION, PowerSystemUnits.WATT_PER_SQUAREMETRE)
.to(StandardUnits.IRRADIATION);
ComparableQuantity<Irradiation> diffuseIrradiation =
data.getQuantity(DIFFUSE_IRRADIATION, PowerSystemUnits.WATT_PER_SQUAREMETRE)
.to(StandardUnits.IRRADIATION);
ComparableQuantity<Irradiance> directIrradiation =
data.getQuantity(DIRECT_IRRADIANCE, StandardUnits.SOLAR_IRRADIANCE);
ComparableQuantity<Irradiance> diffuseIrradiation =
data.getQuantity(DIFFUSE_IRRADIANCE, StandardUnits.SOLAR_IRRADIANCE);
johanneshiry marked this conversation as resolved.
Show resolved Hide resolved
ComparableQuantity<Temperature> temperature =
data.getQuantity(TEMPERATURE, Units.KELVIN).to(StandardUnits.TEMPERATURE);
ComparableQuantity<Angle> windDirection = getWindDirection(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import edu.ie3.datamodel.models.timeseries.individual.TimeBasedValue;
import edu.ie3.datamodel.models.value.WeatherValue;
import edu.ie3.util.TimeUtil;
import edu.ie3.util.quantities.interfaces.Irradiation;
import edu.ie3.util.quantities.interfaces.Irradiance;
import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.List;
Expand All @@ -28,6 +28,11 @@
*/
public class PsdmTimeBasedWeatherValueFactory extends TimeBasedWeatherValueFactory {
private static final String COORDINATE = "coordinate";
private static final String DIFFUSE_IRRADIANCE = "diffuseirradiation";
private static final String DIRECT_IRRADIANCE = "directirradiation";
johanneshiry marked this conversation as resolved.
Show resolved Hide resolved
private static final String TEMPERATURE = "temperature";
private static final String WIND_DIRECTION = "winddirection";
private static final String WIND_VELOCITY = "windvelocity";

public PsdmTimeBasedWeatherValueFactory(TimeUtil timeUtil) {
super(timeUtil);
Expand Down Expand Up @@ -57,8 +62,8 @@ protected List<Set<String>> getFields(TimeBasedWeatherValueData data) {
newSet(
UUID,
TIME,
DIFFUSE_IRRADIATION,
DIRECT_IRRADIATION,
DIFFUSE_IRRADIANCE,
DIRECT_IRRADIANCE,
TEMPERATURE,
WIND_DIRECTION,
WIND_VELOCITY);
Expand All @@ -70,10 +75,10 @@ protected TimeBasedValue<WeatherValue> buildModel(TimeBasedWeatherValueData data
Point coordinate = data.getCoordinate();
java.util.UUID uuid = data.getUUID(UUID);
ZonedDateTime time = timeUtil.toZonedDateTime(data.getField(TIME));
ComparableQuantity<Irradiation> directIrradiation =
data.getQuantity(DIRECT_IRRADIATION, StandardUnits.IRRADIATION);
ComparableQuantity<Irradiation> diffuseIrradiation =
data.getQuantity(DIFFUSE_IRRADIATION, StandardUnits.IRRADIATION);
ComparableQuantity<Irradiance> directIrradiance =
data.getQuantity(DIRECT_IRRADIANCE, StandardUnits.SOLAR_IRRADIANCE);
ComparableQuantity<Irradiance> diffuseIrradiance =
data.getQuantity(DIFFUSE_IRRADIANCE, StandardUnits.SOLAR_IRRADIANCE);
johanneshiry marked this conversation as resolved.
Show resolved Hide resolved
ComparableQuantity<Temperature> temperature =
data.getQuantity(TEMPERATURE, StandardUnits.TEMPERATURE);
ComparableQuantity<Angle> windDirection =
Expand All @@ -83,8 +88,8 @@ protected TimeBasedValue<WeatherValue> buildModel(TimeBasedWeatherValueData data
WeatherValue weatherValue =
new WeatherValue(
coordinate,
directIrradiation,
diffuseIrradiation,
directIrradiance,
diffuseIrradiance,
temperature,
windDirection,
windVelocity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ public class TimeBasedSimpleValueFactory<V extends Value>
private static final String ACTIVE_POWER = "p";
private static final String REACTIVE_POWER = "q";
private static final String HEAT_DEMAND = "heatdemand";
/* Weather */
public static final String DIFFUSE_IRRADIATION = "diffuseirradiation";
public static final String DIRECT_IRRADIATION = "directirradiation";
public static final String TEMPERATURE = "temperature";
public static final String WIND_DIRECTION = "winddirection";
public static final String WIND_VELOCITY = "windvelocity";

private final TimeUtil timeUtil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public enum FieldSource {
TIMESERIES,
ENTRY,
VALUE,
WEATHER_IRRADIATION,
WEATHER_IRRADIANCE,
WEATHER_TEMPERATURE,
WEATHER_WIND
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class TimeSeriesProcessor<
new TimeSeriesProcessorKey(
IndividualTimeSeries.class, TimeBasedValue.class, WindValue.class),
new TimeSeriesProcessorKey(
IndividualTimeSeries.class, TimeBasedValue.class, IrradiationValue.class),
IndividualTimeSeries.class, TimeBasedValue.class, SolarIrradianceValue.class),
new TimeSeriesProcessorKey(
IndividualTimeSeries.class, TimeBasedValue.class, WeatherValue.class),
new TimeSeriesProcessorKey(
Expand Down Expand Up @@ -134,20 +134,21 @@ private SortedMap<String, FieldSourceToMethod> buildFieldToSource(
Stream.concat(
Stream.concat(
mapFieldNameToGetter(
valueClass, Arrays.asList("irradiation", "temperature", "wind"))
valueClass,
Arrays.asList("solarIrradiance", "temperature", "wind"))
.entrySet().stream()
.map(
entry ->
new AbstractMap.SimpleEntry<>(
entry.getKey(),
new FieldSourceToMethod(VALUE, entry.getValue()))),
mapFieldNameToGetter(IrradiationValue.class).entrySet().stream()
mapFieldNameToGetter(SolarIrradianceValue.class).entrySet().stream()
.map(
entry ->
new AbstractMap.SimpleEntry<>(
entry.getKey(),
new FieldSourceToMethod(
WEATHER_IRRADIATION, entry.getValue())))),
WEATHER_IRRADIANCE, entry.getValue())))),
mapFieldNameToGetter(TemperatureValue.class).entrySet().stream()
.map(
entry ->
Expand Down Expand Up @@ -235,8 +236,8 @@ private Map<String, String> handleEntry(T timeSeries, E entry) {
if (entry.getValue() instanceof WeatherValue) {
WeatherValue weatherValue = (WeatherValue) entry.getValue();

Map<String, Method> irradiationFieldToMethod = extractFieldToMethod(WEATHER_IRRADIATION);
valueResult.putAll(processObject(weatherValue.getIrradiation(), irradiationFieldToMethod));
Map<String, Method> irradianceFieldToMethod = extractFieldToMethod(WEATHER_IRRADIANCE);
valueResult.putAll(processObject(weatherValue.getSolarIrradiance(), irradianceFieldToMethod));

Map<String, Method> temperatureFieldToMethod = extractFieldToMethod(WEATHER_TEMPERATURE);
valueResult.putAll(processObject(weatherValue.getTemperature(), temperatureFieldToMethod));
Expand Down
19 changes: 8 additions & 11 deletions src/main/java/edu/ie3/datamodel/models/StandardUnits.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ public class StandardUnits {
public static final Unit<Area> ROTOR_AREA = SQUARE_METRE;
/** Height of the hub of an wind energy converter in metre */
public static final Unit<Length> HUB_HEIGHT = METRE;
/** Price per energy in euro_per_MWhour */
/** Price per energy in euro per megawatt hour */
public static final Unit<EnergyPrice> ENERGY_PRICE = EURO_PER_MEGAWATTHOUR;
/** 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;
/** Direction of the wind in 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 */
/** Velocity of the wind in metre per second */
public static final Unit<Speed> WIND_VELOCITY = METRE_PER_SECOND;
/** Standard unit for the Betz' coefficient curve of wind energy converters in p.U. */
public static final Unit<Dimensionless> CP_CHARACTERISTIC = PU;
Expand All @@ -112,14 +112,11 @@ public class StandardUnits {
public static final Unit<Dimensionless> OLM_CHARACTERISTIC = PU;
/** Standard unit for reactive power characteristics in p.U. */
public static final Unit<Dimensionless> Q_CHARACTERISTIC = PU;
/** Solar irradiation on a flat surface as Power per Area in kW/m² */
public static final Unit<Irradiation> IRRADIATION = KILOWATT_PER_SQUAREMETRE;
/**
* Energy per Area, used as an outdated dimension for {@link StandardUnits#IRRADIATION} in kWh/m²
*
* @deprecated Use {@link Irradiation} together with {@link StandardUnits#IRRADIATION}
*/
@Deprecated public static final Unit<EnergyDensity> ENERGY_DENSITY = KILOWATTHOUR_PER_SQUAREMETRE;
/** Solar irradiance on a flat surface as power per area in W/m² */
public static final Unit<Irradiance> SOLAR_IRRADIANCE = WATT_PER_SQUAREMETRE;
/** Solar irradiation on a flat surface as integrated irradiance over a given time in Wh/m² */
public static final Unit<Irradiation> SOLAR_IRRADIATION = WATTHOUR_PER_SQUAREMETRE;

/** Capex (capital expenditure) in € */
public static final Unit<Currency> CAPEX = EURO;
/** Length of a line in km */
Expand Down
Loading