Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b9da44e
adapted curl for branch name in Jenkinsfile
johanneshiry Mar 26, 2020
38ccef1
added NonCPS annotation in Jenkinsfile
johanneshiry Mar 26, 2020
11ef1f1
Merge remote-tracking branch 'remotes/origin/master' into ck/#73-inpu…
ckittl Mar 26, 2020
1885cd5
Joining AssetInputProcessor and GraphicInputProcessor to InputEntityP…
ckittl Mar 26, 2020
29329ff
Processing OperatorInput
ckittl Mar 26, 2020
8e99cce
Processing RandomLoadParameters
ckittl Mar 26, 2020
6f097a9
Adapting AssetCharacteristicInput and processing those elements
ckittl Mar 26, 2020
285c5ca
Processing WecTypeInput
ckittl Mar 26, 2020
37b8b9c
Processing Transformer2WTypeInput
ckittl Mar 27, 2020
e59200f
Refactoring handling of quantities
ckittl Mar 27, 2020
76e3550
Processing Transformer3WTypeInput
ckittl Mar 27, 2020
5ff98f5
Processing LineTypeInput
ckittl Mar 27, 2020
6aa5e69
Processing EvTypeInput
ckittl Mar 27, 2020
763caf2
Processing ChpTypeInput
ckittl Mar 27, 2020
3521497
Processing HpTypeInput
ckittl Mar 27, 2020
b4996a3
Processing BmTypeInput
ckittl Mar 27, 2020
a4d0094
Processing StorageTypeInput
ckittl Mar 27, 2020
48e878c
Harmonising field names
ckittl Mar 27, 2020
febb0e6
Adding TypeTestData to uml diagram
ckittl Mar 27, 2020
e578351
Only look explicitly for those Quantities that have to bee treated se…
ckittl Mar 27, 2020
aa555a5
Merge remote-tracking branch 'remotes/origin/master' into ck/#73-inpu…
ckittl Mar 30, 2020
b833c1b
Merge remote-tracking branch 'remotes/origin/master' into ck/#73-inpu…
ckittl Mar 30, 2020
68535f8
addressing codacy issues
johanneshiry Mar 30, 2020
a4f3ede
addressing codacy issues
johanneshiry Mar 30, 2020
8430f43
Adapt implementation to Documentation :-D
ckittl Mar 31, 2020
e66ba9b
Homogenize naming
ckittl Mar 31, 2020
b5d8e02
Update src/main/java/edu/ie3/datamodel/models/input/OperatorInput.java
ckittl Mar 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions docs/uml/main/InputDatamodelConcept.puml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@ abstract Class ConnectorInput {
}
ConnectorInput --|> AssetInput

abstract Class AssetCharacteristicsInput {
+ type: String
abstract Class AssetCharacteristicsInput<T extends AssetTypeInput> {
- type: T
- characteristic: String
}
AssetCharacteristicsInput --|> InputEntity

Class WecCharacteristicInput {
}
WecCharacteristicInput --|> AssetCharacteristicsInput: <<bind>>T::WecTypeInput

Class EvCharacteristicInput {
}
EvCharacteristicInput --|> AssetCharacteristicsInput: <<bind>>T::EvTypeInput

abstract Class AssetTypeInput {
+ id: String
}
Expand Down Expand Up @@ -161,18 +170,6 @@ Class Transformer3WTypeInput {
}
Transformer3WTypeInput --|> AssetTypeInput


Class WecCharacteristicInput {
+ cpCharacteristic: String
}
WecCharacteristicInput --|> AssetCharacteristicsInput

Class EvCharacteristicInput {
???
}
EvCharacteristicInput --|> AssetCharacteristicsInput


Class RandomLoadParameter {
+ quarterHour: Integer
+ kWd: Double
Expand Down
2 changes: 2 additions & 0 deletions docs/uml/test/TestDataHierarchy.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Interface GridTestData
Interface ComplexTopology
Interface SystemParticipantTestData
Interface TypeTestData

GridTestData <|-- ComplexTopology
GridTestData <|-- SystemParticipantTestData
GridTestData <|-- TypeTestData
@enduml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

public class NodeInputFactory extends AssetInputEntityFactory<NodeInput, AssetInputEntityData> {
private static final String V_TARGET = "vtarget";
public static final String V_RATED = "vrated";
public static final String V_RATED = "vRated";
private static final String SLACK = "slack";
private static final String GEO_POSITION = "geoposition";
public static final String VOLT_LVL = "voltlvl";
public static final String VOLT_LVL = "voltLvl";
private static final String SUBNET = "subnet";

public NodeInputFactory() {
Expand All @@ -29,7 +29,9 @@ public NodeInputFactory() {

@Override
protected String[] getAdditionalFields() {
return new String[] {V_TARGET, V_RATED, SLACK, GEO_POSITION, VOLT_LVL, SUBNET};
return new String[] {
V_TARGET, V_RATED.toLowerCase(), SLACK, GEO_POSITION, VOLT_LVL.toLowerCase(), SUBNET
};
}

@Override
Expand All @@ -43,7 +45,7 @@ protected NodeInput buildModel(
data.getQuantity(V_TARGET, StandardUnits.TARGET_VOLTAGE_MAGNITUDE);
final boolean slack = data.getBoolean(SLACK);
final Point geoPosition = data.getPoint(GEO_POSITION).orElse(null);
final VoltageLevel voltLvl = data.getVoltageLvl(VOLT_LVL, V_RATED);
final VoltageLevel voltLvl = data.getVoltageLvl(VOLT_LVL.toLowerCase(), V_RATED.toLowerCase());
final int subnet = data.getInt(SUBNET);
return new NodeInput(
uuid, operationTime, operatorInput, id, vTarget, slack, geoPosition, voltLvl, subnet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class SystemParticipantTypeInputFactory
private static final String E_CONS = "econs";

// BmTypeInput
private static final String LOAD_GRADIENT = "loadgradient";
private static final String ACTIVE_POWER_GRADIENT = "activepowergradient";

// WecTypeInput
private static final String ROTOR_AREA = "rotorarea";
Expand All @@ -50,7 +50,6 @@ public class SystemParticipantTypeInputFactory

// StorageTypeInput
private static final String P_MAX = "pmax";
private static final String CP_RATE = "cprate";
private static final String ETA = "eta";
private static final String DOD = "dod";
private static final String LIFETIME = "lifetime";
Expand All @@ -77,7 +76,7 @@ protected List<Set<String>> getFields(SimpleEntityData data) {
} else if (data.getEntityClass().equals(HpTypeInput.class)) {
constructorParameters = expandSet(standardConstructorParams, P_THERMAL);
} else if (data.getEntityClass().equals(BmTypeInput.class)) {
constructorParameters = expandSet(standardConstructorParams, LOAD_GRADIENT, ETA_CONV);
constructorParameters = expandSet(standardConstructorParams, ACTIVE_POWER_GRADIENT, ETA_CONV);
} else if (data.getEntityClass().equals(WecTypeInput.class)) {
constructorParameters =
expandSet(standardConstructorParams, ETA_CONV, ROTOR_AREA, HUB_HEIGHT);
Expand All @@ -87,7 +86,14 @@ protected List<Set<String>> getFields(SimpleEntityData data) {
} else if (data.getEntityClass().equals(StorageTypeInput.class)) {
constructorParameters =
expandSet(
standardConstructorParams, E_STORAGE, P_MAX, CP_RATE, ETA, DOD, LIFETIME, LIFECYCLE);
standardConstructorParams,
E_STORAGE,
P_MAX,
ACTIVE_POWER_GRADIENT,
ETA,
DOD,
LIFETIME,
LIFECYCLE);
}

return Collections.singletonList(constructorParameters);
Expand Down Expand Up @@ -156,7 +162,7 @@ private SystemParticipantTypeInput buildBmTypeInput(
Quantity<Power> sRated,
double cosPhi) {
Quantity<DimensionlessRate> loadGradient =
data.getQuantity(LOAD_GRADIENT, StandardUnits.LOAD_GRADIENT);
data.getQuantity(ACTIVE_POWER_GRADIENT, StandardUnits.ACTIVE_POWER_GRADIENT);
Quantity<Dimensionless> etaConv = data.getQuantity(ETA_CONV, StandardUnits.EFFICIENCY);

return new BmTypeInput(uuid, id, capEx, opEx, loadGradient, sRated, cosPhi, etaConv);
Expand Down Expand Up @@ -204,14 +210,26 @@ private SystemParticipantTypeInput buildStorageTypeInput(
double cosPhi) {
Quantity<Energy> eStorage = data.getQuantity(E_STORAGE, StandardUnits.ENERGY_IN);
Quantity<Power> pMax = data.getQuantity(P_MAX, StandardUnits.ACTIVE_POWER_IN);
Quantity<DimensionlessRate> cprate = data.getQuantity(CP_RATE, StandardUnits.CP_RATE);
Quantity<DimensionlessRate> activePowerGradient =
data.getQuantity(ACTIVE_POWER_GRADIENT, StandardUnits.ACTIVE_POWER_GRADIENT);
Quantity<Dimensionless> eta = data.getQuantity(ETA, StandardUnits.EFFICIENCY);
Quantity<Dimensionless> dod = data.getQuantity(DOD, StandardUnits.DOD);
Quantity<Time> lifeTime = data.getQuantity(LIFETIME, StandardUnits.LIFE_TIME);
int lifeCycle = data.getInt(LIFECYCLE);

return new StorageTypeInput(
uuid, id, capEx, opEx, eStorage, sRated, cosPhi, pMax, cprate, eta, dod, lifeTime,
uuid,
id,
capEx,
opEx,
eStorage,
sRated,
cosPhi,
pMax,
activePowerGradient,
eta,
dod,
lifeTime,
lifeCycle);
}
}
86 changes: 21 additions & 65 deletions src/main/java/edu/ie3/datamodel/io/processor/EntityProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
import edu.ie3.datamodel.models.input.system.StorageStrategy;
import edu.ie3.datamodel.models.voltagelevels.VoltageLevel;
import edu.ie3.util.TimeTools;
import edu.ie3.util.quantities.interfaces.EnergyPrice;
import java.beans.Introspector;
import java.lang.reflect.Method;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.stream.Collectors;
import javax.measure.Quantity;
import javax.measure.quantity.*;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -53,6 +51,14 @@ public abstract class EntityProcessor<T extends UniqueEntity> {
private static final String VOLT_LVL = NodeInputFactory.VOLT_LVL;
private static final String V_RATED = NodeInputFactory.V_RATED;

/* Quantities associated to those fields must be treated differently (e.g. input and result), all other quantity /
* field combinations can be treated on a common basis and therefore need no further distinction */
private static final Set<String> specificQuantityFieldNames =
Collections.unmodifiableSet(
new HashSet<>(
Arrays.asList(
"eConsAnnual", "energy", "eStorage", "q", "p", "pMax", "pOwn", "pThermal")));

private static final GeoJsonWriter geoJsonWriter = new GeoJsonWriter();

/** Field name of {@link UniqueEntity} uuid */
Expand Down Expand Up @@ -181,6 +187,14 @@ private Optional<LinkedHashMap<String, String>> processEntity(T entity) {
return resultMapOpt;
}

/**
* Processes the returned object to String by taking care of different conventions.
*
* @param methodReturnObject Return object to process
* @param method The method, that is invoked
* @param fieldName Name of the foreseen field
* @return A String representation of the result
*/
private String processMethodResult(Object methodReturnObject, Method method, String fieldName) {

StringBuilder resultStringBuilder = new StringBuilder();
Expand Down Expand Up @@ -228,6 +242,7 @@ private String processMethodResult(Object methodReturnObject, Method method, Str
resultStringBuilder.append(((StorageStrategy) methodReturnObject).getToken());
break;
case "NodeInput":
case "AssetTypeInput":
case "Transformer3WTypeInput":
case "Transformer2WTypeInput":
case "LineTypeInput":
Expand Down Expand Up @@ -323,8 +338,6 @@ protected String processVoltageLevel(VoltageLevel voltageLevel, String fieldName
+ "' in result entity "
+ getRegisteredClass().getSimpleName()
+ ".class.")));
;

return resultStringBuilder.toString();
}

Expand All @@ -337,68 +350,11 @@ protected String processVoltageLevel(VoltageLevel voltageLevel, String fieldName
* or empty if an error occurred during processing
*/
protected Optional<String> handleQuantity(Quantity<?> quantity, String fieldName) {

Optional<String> normalizedQuantityValue = Optional.empty();

switch (fieldName) {
case "p":
case "q":
case "energy":
case "vTarget":
case "vrated":
case "sRated":
case "eConsAnnual":
normalizedQuantityValue = handleProcessorSpecificQuantity(quantity, fieldName);
break;
case "soc":
case "vAng":
case "vMag":
case "iAAng":
case "iBAng":
case "iCAng":
case "etaConv":
case "azimuth":
case "height":
normalizedQuantityValue = quantityValToOptionalString(quantity);
break;
case "iAMag":
case "iBMag":
case "iCMag":
normalizedQuantityValue =
quantityValToOptionalString(
quantity
.asType(ElectricCurrent.class)
.to(StandardUnits.ELECTRIC_CURRENT_MAGNITUDE));
break;
case "qDot":
normalizedQuantityValue =
quantityValToOptionalString(
quantity.asType(Power.class).to(StandardUnits.Q_DOT_RESULT));
break;
case "fillLevel":
normalizedQuantityValue =
quantityValToOptionalString(
quantity.asType(Dimensionless.class).to(StandardUnits.FILL_LEVEL));
break;
case "length":
normalizedQuantityValue =
quantityValToOptionalString(
quantity.asType(Length.class).to(StandardUnits.LINE_LENGTH));
break;

case "feedInTariff":
normalizedQuantityValue =
quantityValToOptionalString(
quantity.asType(EnergyPrice.class).to(StandardUnits.ENERGY_PRICE));
break;
default:
log.error(
"Cannot process quantity with value '{}' for field with name {} in model processing!",
quantity,
fieldName);
break;
if (specificQuantityFieldNames.contains(fieldName)) {
return handleProcessorSpecificQuantity(quantity, fieldName);
} else {
return quantityValToOptionalString(quantity);
}
return normalizedQuantityValue;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
package edu.ie3.datamodel.io.processor;

import edu.ie3.datamodel.exceptions.ProcessorProviderException;
import edu.ie3.datamodel.io.processor.input.AssetInputProcessor;
import edu.ie3.datamodel.io.processor.input.GraphicInputProcessor;
import edu.ie3.datamodel.io.processor.input.InputEntityProcessor;
import edu.ie3.datamodel.io.processor.result.ResultEntityProcessor;
import edu.ie3.datamodel.models.UniqueEntity;
import edu.ie3.datamodel.models.input.AssetInput;
import edu.ie3.datamodel.models.input.graphics.GraphicInput;
import edu.ie3.datamodel.models.input.InputEntity;
import edu.ie3.datamodel.models.result.ResultEntity;
import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -133,13 +131,8 @@ private Collection<EntityProcessor<? extends UniqueEntity>> allProcessors() {

// todo add missing processors here
// AssetInput
for (Class<? extends AssetInput> cls : AssetInputProcessor.eligibleEntityClasses) {
resultingProcessors.add(new AssetInputProcessor(cls));
}

// GraphicInput
for (Class<? extends GraphicInput> cls : GraphicInputProcessor.eligibleEntityClasses) {
resultingProcessors.add(new GraphicInputProcessor(cls));
for (Class<? extends InputEntity> cls : InputEntityProcessor.eligibleEntityClasses) {
resultingProcessors.add(new InputEntityProcessor(cls));
}

// SystemParticipantResults
Expand Down

This file was deleted.

Loading