Skip to content

Commit

Permalink
Added JavaDocs and readthedocs for EvcsLocationType
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-peter committed Aug 18, 2021
1 parent c07ee56 commit df5b050
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
32 changes: 29 additions & 3 deletions docs/readthedocs/models/input/participant/evcs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Entity Model
+------------------+---------+--------------------------------------------------------------------------------------+
| cosPhiRated | -- | Rated power factor |
+------------------+---------+--------------------------------------------------------------------------------------+
| locationType | -- | :ref:`Charging station location types<location_types>` |
+------------------+---------+--------------------------------------------------------------------------------------+

Type Model
""""""""""""
Expand All @@ -48,11 +50,11 @@ The actual model definition for charging point types looks as follows:
| Attribute | Unit | Remarks |
+========================+=========+================================================================================+
| id | -- | Human readable identifier |
+------------------------+---+-----+--------------------------------------------------------------------------------+
+------------------------+---------+--------------------------------------------------------------------------------+
| sRated | kVA | Rated apparent power |
+------------------------+---+-----+--------------------------------------------------------------------------------+
+------------------------+---------+--------------------------------------------------------------------------------+
| electricCurrentType | -- | Electric current type |
+------------------------+---+-----+--------------------------------------------------------------------------------+
+------------------------+---------+--------------------------------------------------------------------------------+
|synonymousIds | -- | Set of alternative human readable identifiers |
+------------------------+---------+--------------------------------------------------------------------------------+

Expand Down Expand Up @@ -117,6 +119,30 @@ Limitations
all attributes (e.g. :code:`sRated` or :code:`connectionType`) are considered to be equal for all connection
points

.. _location_types:

Location types
^^^^^^^^^^^^^^

Evcs location types describe the type of charging location of a charging station. Parsing of these types is case-insensitive
and underscores and minuses are ignored, that means "charginghubtown" is parsed as type :code:`CHARGING_HUB_TOWN`.

+-------------------------------+-------------------+----------------------------------+
| type name | public/private | description |
+===============================+===================+==================================+
| HOME | private | Charging at home |
+-------------------------------+-------------------+----------------------------------+
| WORK | private | Charging at work |
+-------------------------------+-------------------+----------------------------------+
| CUSTOMER_PARKING | public | Charging at store parking lots |
+-------------------------------+-------------------+----------------------------------+
| STREET | public | Charging at street side |
+-------------------------------+-------------------+----------------------------------+
| CHARGING_HUB_TOWN | public | Charging at hub in town |
+-------------------------------+-------------------+----------------------------------+
| CHARGING_HUB_HIGHWAY | public | Charging at hub out of town |
+-------------------------------+-------------------+----------------------------------+

Caveats
^^^^^^^
Nothing - at least not known.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@
*/
package edu.ie3.datamodel.models.input.system.type.evcslocation;

/**
* Describes type of location of an {@link edu.ie3.datamodel.models.input.system.EvcsInput}. Parsing
* strings into one of these types is done in {@link EvcsLocationTypeUtils}.
*/
public enum EvcsLocationType {
/** Charging at home (private home or apartment building, type: private location) */
HOME,
/** Charging at work (type: private location) */
WORK,
/** Charging at store parking lots (type: public location) */
CUSTOMER_PARKING,
/** Charging at street side (type: public location) */
STREET,
/** Charging at hub in town (type: public location) */
CHARGING_HUB_TOWN,
/** Charging at hub out of town, highway (type: public location) */
CHARGING_HUB_HIGHWAY
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import edu.ie3.datamodel.exceptions.ParsingException;
import java.util.HashMap;

/**
* Utility class providing tools to retrieve {@link EvcsLocationType}s from string representation
*/
public class EvcsLocationTypeUtils {

private static final HashMap<String, EvcsLocationType> nameToType = initMap();
Expand All @@ -19,16 +22,33 @@ private static HashMap<String, EvcsLocationType> initMap() {
return map;
}

/**
* This is a static utility class. Do not instantiate!
*/
private EvcsLocationTypeUtils() {
throw new IllegalStateException("This is a factory class. Don't try to instantiate it.");
}

/**
* Parsing a location type string into one {@link EvcsLocationType}.
* Matching the string is case-insensitive and all - and _ are removed.
* Throws exception, if type does not exist.
*
* @param parsableString string to parse
* @return corresponding EvcsLocationType
* @throws ParsingException if string does not represent a location type
*/
public static EvcsLocationType parse(String parsableString) throws ParsingException {
final String key = toKey(parsableString);
if (nameToType.containsKey(key)) return nameToType.get(key);
else throw new ParsingException("EvcsLocationType '" + key + "' does not exist.");
}

/**
* Turns string to lower case and removes underscores and minuses.
* @param name name to turn into key
* @return key
*/
private static String toKey(String name) {
return name.toLowerCase().replaceAll("[-_]*", "");
}
Expand Down

0 comments on commit df5b050

Please sign in to comment.