Validation Utils
This page gives an overview about the ValidationUtils in the PowerSystemDataModel.
What are the ValidationUtils?
The methods in ValidationUtils and subclasses can be used to check that objects are valid. The checks can be separated into two types:
General validation
Uniqueness validation
What is checked?
The general validation checks:
if assigned values are valid, e.g. lines are not allowed to have negative lengths or the rated power factor of any unit must be between 0 and 1
furthermore, several connections are checked, e.g. that lines only connect nodes of the same voltage level or that the voltage levels indicated for the transformer sides match the voltage levels of the nodes they are connected to.
The uniqueness validation checks if a collection of given objects are unique in either:
a specific field
or in a combination of multiple fields
For example AssetInputs
needs to be unique in their uuid
and in their id
while
weather values
needs to be unique in the combination of their time
and their coordinate
.
How to use?
To use the general validation the user should call the method
ValidationUtils.check(Object)
.To use the uniqueness validation the user should call a method of
UniquenessValidationUtils
to check the uniqueness.
How does the general validation work?
The method
ValidationUtils.check(Object)
identifies the object class and forwards it to a specific check method for the given objectThe overall structure of the ValidationUtils methods follows a cascading scheme, orientated along the class tree
Example: A
LineInput lineInput
should be checkedValidationUtils.check(lineInput)
is calledValidationUtils.check(lineInput)
identifies the class of the object asAssetInput
and callsValidationUtils.checkAsset(lineInput)
ValidationUtils.checkAsset(lineInput)
, if applicable, checks those parameters that allAssetInput
have in common (e.g. operation time) and further identifies the object, more specifically, as aConnectorInput
and callsConnectorValidationUtils.check(lineInput)
ConnectorValidationUtils.check(lineInput)
, if applicable, checks those parameters that allConnectorInput
have in common and further identifies the object, more specifically, as aLineInput
and callsConnectorValidationUtils.checkLine(lineInput)
ConnectorValidationUtils.checkLine(lineInput)
checks all specific parameters of aLineInput
ValidationUtils furthermore contains several utils methods used in the subclasses
Which objects are checked?
The ValidationUtils include validation checks for…
NodeValidationUtils
NodeInput
VoltageLevel
ConnectorValidationUtils:
ConnectorInput
LineInput
Transformer2WInput
Transformer3WInput
SwitchInput
ConnectorTypeInput
LineTypeInput
Transformer2WTypeInput
Transformer3WTypeInput
MeasurementUnitValidationUtils
MeasurementUnitInput
SystemParticipantValidationUtils
SystemParticipantInput
BmInput
ChpInput
EvInput
FixedFeedInInput
HpInput
LoadInput
PvInput
StorageInput
WecInput
EvcsInput (also checks ChargingPointType)
SystemParticipantTypeInput
BmTypeInput
ChpTypeInput
EvTypeInput
HpTypeInput
StorageTypeInput
WecTypeInput
ThermalUnitValidationUtils
ThermalUnitInput
ThermalSinkInput
ThermalHouseInput
ThermalStorageInput
CylindricalStorageInput
GraphicValidationUtils
GraphicInput
LineGraphicInput
NodeGraphicInput
GridContainerValidationUtils
GraphicElements
GridContainer
RawGridElements
SystemParticipants
What should be considered?
Due to many checks with if-conditions, the usage of the ValidationUtils for many objects might be runtime relevant.
The check for a GridContainer includes the interplay of the contained entities as well as the checks of all contained entities.
If new classes are introduced to the PowerSystemDataModel, make sure to follow the forwarding structure of the ValidationUtils methods when writing the check methods!