Skip to content

Commit

Permalink
Fix warnings in readthedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ckittl committed Nov 10, 2021
1 parent 44882d4 commit 01b8f26
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 36 deletions.
10 changes: 5 additions & 5 deletions docs/readthedocs/models/ValidationUtils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ 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, meaning their parameters have valid values and they are correctly connected.

What is checked?
^^^^^^^^^^^^^^^^
================
- The check methods include checks that 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.

How does it work?
^^^^^^^^^^^^^^^^^
=================
- The method :code:`ValidationUtils.check(Object)` is the only method that should be called by the user.
- This check method identifies the object class and forwards it to a specific check method for the given object
- The overall structure of the ValidationUtils methods follows a cascading scheme, orientated along the class tree
Expand All @@ -26,7 +26,7 @@ How does it work?
- ValidationUtils furthermore contains several utils methods used in the subclasses

Which objects are checked?
^^^^^^^^^^^^^^^^^^^^^^^^^^
==========================
The ValidationUtils include validation checks for...

- NodeValidationUtils
Expand Down Expand Up @@ -81,7 +81,7 @@ The ValidationUtils include validation checks for...
- 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!
4 changes: 2 additions & 2 deletions docs/readthedocs/models/input/grid/line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Entity Model
| nodeB | -- | |
+-------------------+------+--------------------------------------------------------+
| parallelDevices | -- | | overall amount of parallel lines to automatically |
| | -- | | construct (e.g. parallelDevices = 2 will build a |
| | -- | | total of two lines using the specified parameters) |
| | | | construct (e.g. parallelDevices = 2 will build a |
| | | | total of two lines using the specified parameters) |
+-------------------+------+--------------------------------------------------------+
| type | -- | |
+-------------------+------+--------------------------------------------------------+
Expand Down
4 changes: 2 additions & 2 deletions docs/readthedocs/models/input/grid/transformer2w.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ Entity Model
| nodeB | -- | Lower voltage node |
+-----------------+------+------------------------------------------------------------+
| parallelDevices | -- | | overall amount of parallel transformers to automatically |
| | -- | | construct (e.g. parallelDevices = 2 will build a |
| | -- | | total of two transformers using the specified parameters)|
| | | | construct (e.g. parallelDevices = 2 will build a |
| | | | total of two transformers using the specified parameters)|
+-----------------+------+------------------------------------------------------------+
| type | -- | |
+-----------------+------+------------------------------------------------------------+
Expand Down
4 changes: 2 additions & 2 deletions docs/readthedocs/models/input/grid/transformer3w.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Entity Model
| nodeC | -- | Lowest voltage node |
+-----------------+------+------------------------------------------------------------+
| parallelDevices | -- | | overall amount of parallel transformers to automatically |
| | -- | | construct (e.g. parallelDevices = 2 will build a |
| | -- | | total of two transformers using the specified parameters)|
| | | | construct (e.g. parallelDevices = 2 will build a |
| | | | total of two transformers using the specified parameters)|
+-----------------+------+------------------------------------------------------------+
| type | -- | |
+-----------------+------+------------------------------------------------------------+
Expand Down
51 changes: 26 additions & 25 deletions docs/readthedocs/models/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,32 @@ Equality Checks
instances is not as trivial as it might seem, because there might be different understandings about the equality of
quantities (e.g. there is a big difference between two instances being equal or equivalent). After long discussions how to
treat quantities in the entity :code:`equals()` method, we agreed on the following rules to be applied:
- equality check is done by calling :code:`Objects.equals(<QuantityInstanceA>, <QuantityInstanceB>)` or
:code:`<QuantityInstanceA>.equals(<QuantityInstanceB>)`.
Using :code:`Objects.equals(<QuantityInstanceA>, <QuantityInstanceB>)` is necessary especially for time series data.
As in contrast to all other places, quantity time series from real world data sometimes are not complete and
hence contain missing values. To represent missing values this is the only place where the usage of :code:`null`
is a valid choice and hence needs to be treated accordingly. Please remember that his is only allowed in very few
places and you should try to avoid using :code:`null` for quantities or any other constructor parameter whenever possible!
- equality is given if, and only if, the quantities value object and unit are exactly equal. Value objects can become
e.g. :code:`BigDecimal` or :code:`Double` instances. It is important, that the object type is also the same, otherwise
the entities :code:`equals()` method returns false. This behavior is in sync with the equals implementation
of the indriya library. Hence, you should ensure that your code always pass in the same kind of a quantity instance
with the same underlying number format and type. For this purpose you should especially be aware of the unit conversion
method :code:`AbstractQuantity.to(Quantity)` which may return seemingly unexpected types, e.g. if called on a quantity
with a :code:`double` typed value, it may return a quantity with a value of either :code:`Double` type or :code:`BigDecimal` type.
- for now, there is no default way to compare entities in a 'number equality' way provided. E.g. a line with a length
of 1km compared to a line with a length of 1000m is actually of the same length, but calling :code:`LineA.equals(LineB)`
would return :code:`false` as the equality check does NOT convert units. If you want to compare two entity instances
based on their equivalence you have (for now) check for each quantity manually using their :code:`isEquivalentTo()`
method. If you think you would benefit from a standard method that allows entity equivalence check, please consider
handing in an issue `here <https://github.com/ie3-institute/PowerSystemDataModel/issues>`_.
Furthermore, the current existing implementation of :code:`isEquivalentTo()` in indriya does not allow the provision of
a tolerance threshold that might be necessary when comparing values from floating point operations. We consider
providing such a method in our `PowerSystemUtils <https://github.com/ie3-institute/PowerSystemUtils>`_ library.
If you think you would benefit from such a method, please consider handing in an issue
`here <https://github.com/ie3-institute/PowerSystemUtils/issues>`_.

- equality check is done by calling :code:`Objects.equals(<QuantityInstanceA>, <QuantityInstanceB>)` or
:code:`<QuantityInstanceA>.equals(<QuantityInstanceB>)`.
Using :code:`Objects.equals(<QuantityInstanceA>, <QuantityInstanceB>)` is necessary especially for time series data.
As in contrast to all other places, quantity time series from real world data sometimes are not complete and
hence contain missing values. To represent missing values this is the only place where the usage of :code:`null`
is a valid choice and hence needs to be treated accordingly. Please remember that his is only allowed in very few
places and you should try to avoid using :code:`null` for quantities or any other constructor parameter whenever possible!
- equality is given if, and only if, the quantities value object and unit are exactly equal. Value objects can become
e.g. :code:`BigDecimal` or :code:`Double` instances. It is important, that the object type is also the same, otherwise
the entities :code:`equals()` method returns false. This behavior is in sync with the equals implementation
of the indriya library. Hence, you should ensure that your code always pass in the same kind of a quantity instance
with the same underlying number format and type. For this purpose you should especially be aware of the unit conversion
method :code:`AbstractQuantity.to(Quantity)` which may return seemingly unexpected types, e.g. if called on a quantity
with a :code:`double` typed value, it may return a quantity with a value of either :code:`Double` type or :code:`BigDecimal` type.
- for now, there is no default way to compare entities in a 'number equality' way provided. E.g. a line with a length
of 1km compared to a line with a length of 1000m is actually of the same length, but calling :code:`LineA.equals(LineB)`
would return :code:`false` as the equality check does NOT convert units. If you want to compare two entity instances
based on their equivalence you have (for now) check for each quantity manually using their :code:`isEquivalentTo()`
method. If you think you would benefit from a standard method that allows entity equivalence check, please consider
handing in an issue `here <https://github.com/ie3-institute/PowerSystemDataModel/issues>`_.
Furthermore, the current existing implementation of :code:`isEquivalentTo()` in indriya does not allow the provision of
a tolerance threshold that might be necessary when comparing values from floating point operations. We consider
providing such a method in our `PowerSystemUtils <https://github.com/ie3-institute/PowerSystemUtils>`_ library.
If you think you would benefit from such a method, please consider handing in an issue
`here <https://github.com/ie3-institute/PowerSystemUtils/issues>`_.

Conditional Parameters
Some of the models have conditional parameters. When reading model data from a data source, their respective factories for building these
Expand Down

0 comments on commit 01b8f26

Please sign in to comment.