enums.py 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # SPDX-License-Identifier: Apache-2.0
  2. # Copyright 2020 Contributors to OpenLEADR
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. # Unless required by applicable law or agreed to in writing, software
  8. # distributed under the License is distributed on an "AS IS" BASIS,
  9. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. # See the License for the specific language governing permissions and
  11. # limitations under the License.
  12. """
  13. A collection of useful enumerations that you can use to construct or
  14. interpret OpenADR messages. Can also be useful during testing.
  15. """
  16. class Enum(type):
  17. def __getitem__(self, item):
  18. return getattr(self, item)
  19. @property
  20. def members(self):
  21. return sorted([item for item in list(set(dir(self)) - set(dir(Enum))) if not item.startswith("_")])
  22. @property
  23. def values(self):
  24. return [self[item] for item in self.members]
  25. class EVENT_STATUS(metaclass=Enum):
  26. NONE = "none"
  27. FAR = "far"
  28. NEAR = "near"
  29. ACTIVE = "active"
  30. COMPLETED = "completed"
  31. CANCELLED = "cancelled"
  32. class SIGNAL_TYPE(metaclass=Enum):
  33. DELTA = "delta"
  34. LEVEL = "level"
  35. MULTIPLIER = "multiplier"
  36. PRICE = "price"
  37. PRICE_MULTIPLIER = "priceMultiplier"
  38. PRICE_RELATIVE = "priceRelative"
  39. SETPOINT = "setpoint"
  40. X_LOAD_CONTROL_CAPACITY = "x-loadControlCapacity"
  41. X_LOAD_CONTROL_LEVEL_OFFSET = "x-loadControlLevelOffset"
  42. X_LOAD_CONTROL_PERCENT_OFFSET = "x-loadControlPorcentOffset"
  43. X_LOAD_CONTROL_SETPOINT = "x-loadControlSetpoint"
  44. class SIGNAL_NAME(metaclass=Enum):
  45. SIMPLE = "SIMPLE"
  46. simple = "simple"
  47. ELECTRICITY_PRICE = "ELECTRICITY_PRICE"
  48. ENERGY_PRICE = "ENERGY_PRICE"
  49. DEMAND_CHARGE = "DEMAND_CHARGE"
  50. BID_PRICE = "BID_PRICE"
  51. BID_LOAD = "BID_LOAD"
  52. BID_ENERGY = "BID_ENERGY"
  53. CHARGE_STATE = "CHARGE_STATE"
  54. LOAD_DISPATCH = "LOAD_DISPATCH"
  55. LOAD_CONTROL = "LOAD_CONTROL"
  56. class SI_SCALE_CODE(metaclass=Enum):
  57. p = "p"
  58. n = "n"
  59. micro = "micro"
  60. m = "m"
  61. c = "c"
  62. d = "d"
  63. k = "k"
  64. M = "M"
  65. G = "G"
  66. T = "T"
  67. none = "none"
  68. class OPT(metaclass=Enum):
  69. OPT_IN = "optIn"
  70. OPT_OUT = "optOut"
  71. class OPT_REASON(metaclass=Enum):
  72. ECONOMIC = "economic"
  73. EMERGENCY = "emergency"
  74. MUST_RUN = "mustRun"
  75. NOT_PARTICIPATING = "notParticipating"
  76. OUTAGE_RUN_STATUS = "outageRunStatus"
  77. OVERRIDE_STATUS = "overrideStatus"
  78. PARTICIPATING = "participating"
  79. X_SCHEDULE = "x-schedule"
  80. class READING_TYPE(metaclass=Enum):
  81. DIRECT_READ = "Direct Read"
  82. NET = "Net"
  83. ALLOCATED = "Allocated"
  84. ESTIMATED = "Estimated"
  85. SUMMED = "Summed"
  86. DERIVED = "Derived"
  87. MEAN = "Mean"
  88. PEAK = "Peak"
  89. HYBRID = "Hybrid"
  90. CONTRACT = "Contract"
  91. PROJECTED = "Projected"
  92. X_RMS = "x-RMS"
  93. X_NOT_APPLICABLE = "x-notApplicable"
  94. class REPORT_TYPE(metaclass=Enum):
  95. READING = "reading"
  96. USAGE = "usage"
  97. DEMAND = "demand"
  98. SET_POINT = "setPoint"
  99. DELTA_USAGE = "deltaUsage"
  100. DELTA_SET_POINT = "deltaSetPoint"
  101. DELTA_DEMAND = "deltaDemand"
  102. BASELINE = "baseline"
  103. DEVIATION = "deviation"
  104. AVG_USAGE = "avgUsage"
  105. AVG_DEMAND = "avgDemand"
  106. OPERATING_STATE = "operatingState"
  107. UP_REGULATION_CAPACITY_AVAILABLE = "upRegulationCapacityAvailable"
  108. DOWN_REGULATION_CAPACITY_AVAILABLE = "downRegulationCapacityAvailable"
  109. REGULATION_SETPOINT = "regulationSetpoint"
  110. STORED_ENERGY = "storedEnergy"
  111. TARGET_ENERGY_STORAGE = "targetEnergyStorage"
  112. AVAILABLE_ENERGY_STORAGE = "availableEnergyStorage"
  113. PRICE = "price"
  114. LEVEL = "level"
  115. POWER_FACTOR = "powerFactor"
  116. PERCENT_USAGE = "percentUsage"
  117. PERCENT_DEMAND = "percentDemand"
  118. X_RESOURCE_STATUS = "x-resourceStatus"
  119. class REPORT_NAME(metaclass=Enum):
  120. METADATA_HISTORY_USAGE = "METADATA_HISTORY_USAGE"
  121. HISTORY_USAGE = "HISTORY_USAGE"
  122. METADATA_HISTORY_GREENBUTTON = "METADATA_HISTORY_GREENBUTTON"
  123. HISTORY_GREENBUTTON = "HISTORY_GREENBUTTON"
  124. METADATA_TELEMETRY_USAGE = "METADATA_TELEMETRY_USAGE"
  125. TELEMETRY_USAGE = "TELEMETRY_USAGE"
  126. METADATA_TELEMETRY_STATUS = "METADATA_TELEMETRY_STATUS"
  127. TELEMETRY_STATUS = "TELEMETRY_STATUS"
  128. class STATUS_CODES(metaclass=Enum):
  129. OUT_OF_SEQUENCE = 450
  130. NOT_ALLOWED = 451
  131. INVALID_ID = 452
  132. NOT_RECOGNIZED = 453
  133. INVALID_DATA = 454
  134. COMPLIANCE_ERROR = 459
  135. SIGNAL_NOT_SUPPORTED = 460
  136. REPORT_NOT_SUPPORTED = 461
  137. TARGET_MISMATCH = 462
  138. NOT_REGISTERED_OR_AUTHORIZED = 463
  139. DEPLOYMENT_ERROR_OTHER = 469
  140. class SECURITY_LEVEL:
  141. STANDARD: 'STANDARD'
  142. HIGH: 'HIGH'