zepben.ewb 1.0.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (639) hide show
  1. zepben/ewb/__init__.py +601 -0
  2. zepben/ewb/auth/__init__.py +10 -0
  3. zepben/ewb/auth/client/__init__.py +5 -0
  4. zepben/ewb/auth/client/zepben_token_fetcher.py +273 -0
  5. zepben/ewb/auth/common/__init__.py +5 -0
  6. zepben/ewb/auth/common/auth_exception.py +16 -0
  7. zepben/ewb/auth/common/auth_method.py +28 -0
  8. zepben/ewb/auth/common/auth_provider_config.py +96 -0
  9. zepben/ewb/database/__init__.py +4 -0
  10. zepben/ewb/database/paths/__init__.py +4 -0
  11. zepben/ewb/database/paths/database_type.py +34 -0
  12. zepben/ewb/database/paths/ewb_data_file_paths.py +237 -0
  13. zepben/ewb/database/sqlite/__init__.py +4 -0
  14. zepben/ewb/database/sqlite/common/__init__.py +4 -0
  15. zepben/ewb/database/sqlite/common/base_cim_reader.py +212 -0
  16. zepben/ewb/database/sqlite/common/base_cim_writer.py +159 -0
  17. zepben/ewb/database/sqlite/common/base_collection_reader.py +96 -0
  18. zepben/ewb/database/sqlite/common/base_collection_writer.py +73 -0
  19. zepben/ewb/database/sqlite/common/base_database_reader.py +127 -0
  20. zepben/ewb/database/sqlite/common/base_database_tables.py +137 -0
  21. zepben/ewb/database/sqlite/common/base_database_writer.py +195 -0
  22. zepben/ewb/database/sqlite/common/base_entry_writer.py +34 -0
  23. zepben/ewb/database/sqlite/common/base_service_reader.py +50 -0
  24. zepben/ewb/database/sqlite/common/base_service_writer.py +104 -0
  25. zepben/ewb/database/sqlite/common/metadata_collection_reader.py +39 -0
  26. zepben/ewb/database/sqlite/common/metadata_collection_writer.py +38 -0
  27. zepben/ewb/database/sqlite/common/metadata_entry_reader.py +45 -0
  28. zepben/ewb/database/sqlite/common/metadata_entry_writer.py +41 -0
  29. zepben/ewb/database/sqlite/common/reader_exceptions.py +30 -0
  30. zepben/ewb/database/sqlite/customer/__init__.py +4 -0
  31. zepben/ewb/database/sqlite/customer/customer_cim_reader.py +169 -0
  32. zepben/ewb/database/sqlite/customer/customer_cim_writer.py +137 -0
  33. zepben/ewb/database/sqlite/customer/customer_database_reader.py +44 -0
  34. zepben/ewb/database/sqlite/customer/customer_database_tables.py +37 -0
  35. zepben/ewb/database/sqlite/customer/customer_database_writer.py +45 -0
  36. zepben/ewb/database/sqlite/customer/customer_service_reader.py +57 -0
  37. zepben/ewb/database/sqlite/customer/customer_service_writer.py +47 -0
  38. zepben/ewb/database/sqlite/diagram/__init__.py +4 -0
  39. zepben/ewb/database/sqlite/diagram/diagram_cim_reader.py +105 -0
  40. zepben/ewb/database/sqlite/diagram/diagram_cim_writer.py +81 -0
  41. zepben/ewb/database/sqlite/diagram/diagram_database_reader.py +45 -0
  42. zepben/ewb/database/sqlite/diagram/diagram_database_tables.py +29 -0
  43. zepben/ewb/database/sqlite/diagram/diagram_database_writer.py +44 -0
  44. zepben/ewb/database/sqlite/diagram/diagram_service_reader.py +49 -0
  45. zepben/ewb/database/sqlite/diagram/diagram_service_writer.py +41 -0
  46. zepben/ewb/database/sqlite/extensions/__init__.py +4 -0
  47. zepben/ewb/database/sqlite/extensions/prepared_statement.py +112 -0
  48. zepben/ewb/database/sqlite/extensions/result_set.py +153 -0
  49. zepben/ewb/database/sqlite/network/__init__.py +4 -0
  50. zepben/ewb/database/sqlite/network/network_cim_reader.py +3167 -0
  51. zepben/ewb/database/sqlite/network/network_cim_writer.py +2561 -0
  52. zepben/ewb/database/sqlite/network/network_database_reader.py +173 -0
  53. zepben/ewb/database/sqlite/network/network_database_tables.py +242 -0
  54. zepben/ewb/database/sqlite/network/network_database_writer.py +43 -0
  55. zepben/ewb/database/sqlite/network/network_service_reader.py +265 -0
  56. zepben/ewb/database/sqlite/network/network_service_writer.py +209 -0
  57. zepben/ewb/database/sqlite/tables/__init__.py +4 -0
  58. zepben/ewb/database/sqlite/tables/associations/__init__.py +4 -0
  59. zepben/ewb/database/sqlite/tables/associations/loop_substation_relationship.py +17 -0
  60. zepben/ewb/database/sqlite/tables/associations/table_asset_organisation_roles_assets.py +40 -0
  61. zepben/ewb/database/sqlite/tables/associations/table_assets_power_system_resources.py +41 -0
  62. zepben/ewb/database/sqlite/tables/associations/table_battery_units_battery_controls.py +40 -0
  63. zepben/ewb/database/sqlite/tables/associations/table_circuits_substations.py +40 -0
  64. zepben/ewb/database/sqlite/tables/associations/table_circuits_terminals.py +40 -0
  65. zepben/ewb/database/sqlite/tables/associations/table_customer_agreements_pricing_structures.py +40 -0
  66. zepben/ewb/database/sqlite/tables/associations/table_end_devices_end_device_functions.py +40 -0
  67. zepben/ewb/database/sqlite/tables/associations/table_equipment_equipment_containers.py +40 -0
  68. zepben/ewb/database/sqlite/tables/associations/table_equipment_operational_restrictions.py +40 -0
  69. zepben/ewb/database/sqlite/tables/associations/table_equipment_usage_points.py +40 -0
  70. zepben/ewb/database/sqlite/tables/associations/table_loops_substations.py +43 -0
  71. zepben/ewb/database/sqlite/tables/associations/table_pricing_structures_tariffs.py +40 -0
  72. zepben/ewb/database/sqlite/tables/associations/table_protection_relay_functions_protected_switches.py +40 -0
  73. zepben/ewb/database/sqlite/tables/associations/table_protection_relay_functions_sensors.py +40 -0
  74. zepben/ewb/database/sqlite/tables/associations/table_protection_relay_schemes_protection_relay_functions.py +40 -0
  75. zepben/ewb/database/sqlite/tables/associations/table_synchronous_machines_reactive_capability_curves.py +39 -0
  76. zepben/ewb/database/sqlite/tables/associations/table_usage_points_end_devices.py +40 -0
  77. zepben/ewb/database/sqlite/tables/column.py +37 -0
  78. zepben/ewb/database/sqlite/tables/exceptions.py +10 -0
  79. zepben/ewb/database/sqlite/tables/extensions/__init__.py +4 -0
  80. zepben/ewb/database/sqlite/tables/extensions/iec61968/__init__.py +4 -0
  81. zepben/ewb/database/sqlite/tables/extensions/iec61968/assetinfo/__init__.py +4 -0
  82. zepben/ewb/database/sqlite/tables/extensions/iec61968/assetinfo/table_reclose_delays.py +38 -0
  83. zepben/ewb/database/sqlite/tables/extensions/iec61968/assetinfo/table_relay_info.py +21 -0
  84. zepben/ewb/database/sqlite/tables/extensions/iec61968/metering/__init__.py +4 -0
  85. zepben/ewb/database/sqlite/tables/extensions/iec61968/metering/table_pan_demand_response_functions.py +21 -0
  86. zepben/ewb/database/sqlite/tables/extensions/iec61970/__init__.py +4 -0
  87. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/__init__.py +4 -0
  88. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/core/__init__.py +4 -0
  89. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/core/table_sites.py +15 -0
  90. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/feeder/__init__.py +4 -0
  91. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/feeder/table_loops.py +15 -0
  92. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/feeder/table_lv_feeders.py +20 -0
  93. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/generation/__init__.py +4 -0
  94. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/generation/production/__init__.py +4 -0
  95. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/generation/production/table_ev_charging_units.py +15 -0
  96. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/__init__.py +4 -0
  97. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_distance_relays.py +28 -0
  98. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_function_thresholds.py +36 -0
  99. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_function_time_limits.py +34 -0
  100. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_functions.py +24 -0
  101. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_schemes.py +20 -0
  102. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_systems.py +20 -0
  103. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_voltage_relays.py +15 -0
  104. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/wires/__init__.py +4 -0
  105. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/wires/table_battery_controls.py +23 -0
  106. zepben/ewb/database/sqlite/tables/extensions/iec61970/base/wires/table_power_transformer_end_ratings.py +34 -0
  107. zepben/ewb/database/sqlite/tables/iec61968/__init__.py +4 -0
  108. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/__init__.py +4 -0
  109. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_cable_info.py +15 -0
  110. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_no_load_tests.py +24 -0
  111. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_open_circuit_tests.py +24 -0
  112. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_overhead_wire_info.py +15 -0
  113. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_power_transformer_info.py +15 -0
  114. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_short_circuit_tests.py +29 -0
  115. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_shunt_compensator_info.py +23 -0
  116. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_switch_info.py +20 -0
  117. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_end_info.py +46 -0
  118. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_tank_info.py +27 -0
  119. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_test.py +19 -0
  120. zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_wire_info.py +19 -0
  121. zepben/ewb/database/sqlite/tables/iec61968/assets/__init__.py +4 -0
  122. zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_containers.py +14 -0
  123. zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_functions.py +14 -0
  124. zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_info.py +14 -0
  125. zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_organisation_roles.py +14 -0
  126. zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_owners.py +15 -0
  127. zepben/ewb/database/sqlite/tables/iec61968/assets/table_assets.py +18 -0
  128. zepben/ewb/database/sqlite/tables/iec61968/assets/table_streetlights.py +22 -0
  129. zepben/ewb/database/sqlite/tables/iec61968/assets/table_structures.py +14 -0
  130. zepben/ewb/database/sqlite/tables/iec61968/common/__init__.py +4 -0
  131. zepben/ewb/database/sqlite/tables/iec61968/common/table_agreements.py +14 -0
  132. zepben/ewb/database/sqlite/tables/iec61968/common/table_documents.py +23 -0
  133. zepben/ewb/database/sqlite/tables/iec61968/common/table_location_street_address_field.py +18 -0
  134. zepben/ewb/database/sqlite/tables/iec61968/common/table_location_street_addresses.py +33 -0
  135. zepben/ewb/database/sqlite/tables/iec61968/common/table_locations.py +15 -0
  136. zepben/ewb/database/sqlite/tables/iec61968/common/table_organisation_roles.py +18 -0
  137. zepben/ewb/database/sqlite/tables/iec61968/common/table_organisations.py +15 -0
  138. zepben/ewb/database/sqlite/tables/iec61968/common/table_position_points.py +30 -0
  139. zepben/ewb/database/sqlite/tables/iec61968/common/table_street_addresses.py +26 -0
  140. zepben/ewb/database/sqlite/tables/iec61968/common/table_town_details.py +19 -0
  141. zepben/ewb/database/sqlite/tables/iec61968/customers/__init__.py +4 -0
  142. zepben/ewb/database/sqlite/tables/iec61968/customers/table_customer_agreements.py +27 -0
  143. zepben/ewb/database/sqlite/tables/iec61968/customers/table_customers.py +22 -0
  144. zepben/ewb/database/sqlite/tables/iec61968/customers/table_pricing_structures.py +15 -0
  145. zepben/ewb/database/sqlite/tables/iec61968/customers/table_tariffs.py +15 -0
  146. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/__init__.py +4 -0
  147. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassetinfo/__init__.py +4 -0
  148. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassetinfo/table_current_transformer_info.py +33 -0
  149. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassetinfo/table_potential_transformer_info.py +26 -0
  150. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassets/__init__.py +4 -0
  151. zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassets/table_poles.py +20 -0
  152. zepben/ewb/database/sqlite/tables/iec61968/metering/__init__.py +4 -0
  153. zepben/ewb/database/sqlite/tables/iec61968/metering/table_end_device_functions.py +18 -0
  154. zepben/ewb/database/sqlite/tables/iec61968/metering/table_end_devices.py +19 -0
  155. zepben/ewb/database/sqlite/tables/iec61968/metering/table_meters.py +15 -0
  156. zepben/ewb/database/sqlite/tables/iec61968/metering/table_usage_points.py +23 -0
  157. zepben/ewb/database/sqlite/tables/iec61968/operations/__init__.py +4 -0
  158. zepben/ewb/database/sqlite/tables/iec61968/operations/table_operational_restrictions.py +15 -0
  159. zepben/ewb/database/sqlite/tables/iec61970/__init__.py +4 -0
  160. zepben/ewb/database/sqlite/tables/iec61970/base/__init__.py +4 -0
  161. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/__init__.py +4 -0
  162. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_auxiliary_equipment.py +18 -0
  163. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_current_transformers.py +21 -0
  164. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_fault_indicators.py +15 -0
  165. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_potential_transformers.py +21 -0
  166. zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_sensors.py +14 -0
  167. zepben/ewb/database/sqlite/tables/iec61970/base/core/__init__.py +4 -0
  168. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_ac_dc_terminals.py +14 -0
  169. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_base_voltages.py +20 -0
  170. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_conducting_equipment.py +18 -0
  171. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_connectivity_node_containers.py +14 -0
  172. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_connectivity_nodes.py +15 -0
  173. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_curve_data.py +46 -0
  174. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_curves.py +17 -0
  175. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_equipment.py +20 -0
  176. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_equipment_containers.py +14 -0
  177. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_feeders.py +28 -0
  178. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_geographical_regions.py +15 -0
  179. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_identified_objects.py +29 -0
  180. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_name_types.py +28 -0
  181. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_names.py +36 -0
  182. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_power_system_resources.py +19 -0
  183. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_sub_geographical_regions.py +27 -0
  184. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_substations.py +27 -0
  185. zepben/ewb/database/sqlite/tables/iec61970/base/core/table_terminals.py +35 -0
  186. zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/__init__.py +4 -0
  187. zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagram_object_points.py +35 -0
  188. zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagram_objects.py +31 -0
  189. zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagrams.py +21 -0
  190. zepben/ewb/database/sqlite/tables/iec61970/base/equivalents/__init__.py +4 -0
  191. zepben/ewb/database/sqlite/tables/iec61970/base/equivalents/table_equivalent_branches.py +35 -0
  192. zepben/ewb/database/sqlite/tables/iec61970/base/equivalents/table_equivalent_equipment.py +14 -0
  193. zepben/ewb/database/sqlite/tables/iec61970/base/generation/__init__.py +4 -0
  194. zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/__init__.py +4 -0
  195. zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_battery_units.py +22 -0
  196. zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_photo_voltaic_units.py +15 -0
  197. zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_power_electronics_units.py +26 -0
  198. zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_power_electronics_wind_units.py +15 -0
  199. zepben/ewb/database/sqlite/tables/iec61970/base/meas/__init__.py +4 -0
  200. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_accumulators.py +15 -0
  201. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_analogs.py +20 -0
  202. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_controls.py +20 -0
  203. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_discretes.py +15 -0
  204. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_io_points.py +14 -0
  205. zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_measurements.py +30 -0
  206. zepben/ewb/database/sqlite/tables/iec61970/base/protection/__init__.py +4 -0
  207. zepben/ewb/database/sqlite/tables/iec61970/base/protection/table_current_relays.py +22 -0
  208. zepben/ewb/database/sqlite/tables/iec61970/base/scada/__init__.py +4 -0
  209. zepben/ewb/database/sqlite/tables/iec61970/base/scada/table_remote_controls.py +20 -0
  210. zepben/ewb/database/sqlite/tables/iec61970/base/scada/table_remote_points.py +14 -0
  211. zepben/ewb/database/sqlite/tables/iec61970/base/scada/table_remote_sources.py +20 -0
  212. zepben/ewb/database/sqlite/tables/iec61970/base/wires/__init__.py +4 -0
  213. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_ac_line_segments.py +20 -0
  214. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_breakers.py +20 -0
  215. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_busbar_sections.py +15 -0
  216. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_clamps.py +23 -0
  217. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_conductors.py +21 -0
  218. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_connectors.py +14 -0
  219. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_cuts.py +23 -0
  220. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_disconnectors.py +15 -0
  221. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_earth_fault_compensators.py +22 -0
  222. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_connections.py +14 -0
  223. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_consumer_phases.py +37 -0
  224. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_consumers.py +26 -0
  225. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_source_phases.py +33 -0
  226. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_sources.py +44 -0
  227. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_fuses.py +20 -0
  228. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_ground_disconnectors.py +15 -0
  229. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_grounding_impedances.py +24 -0
  230. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_grounds.py +15 -0
  231. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_jumpers.py +15 -0
  232. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_junctions.py +15 -0
  233. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_linear_shunt_compensators.py +23 -0
  234. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_lines.py +14 -0
  235. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_load_break_switches.py +15 -0
  236. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_impedances.py +14 -0
  237. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_line_parameters.py +14 -0
  238. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_phase_impedances.py +18 -0
  239. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_sequence_impedances.py +27 -0
  240. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_petersen_coils.py +27 -0
  241. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_phase_impedance_data.py +52 -0
  242. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_electronics_connection_phases.py +30 -0
  243. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_electronics_connections.py +50 -0
  244. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_transformer_ends.py +43 -0
  245. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_transformers.py +24 -0
  246. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_protected_switches.py +18 -0
  247. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_ratio_tap_changers.py +28 -0
  248. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_reactive_capability_curves.py +18 -0
  249. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_reclosers.py +15 -0
  250. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_regulating_cond_eq.py +19 -0
  251. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_regulating_controls.py +29 -0
  252. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_rotating_machines.py +36 -0
  253. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_series_compensators.py +25 -0
  254. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_shunt_compensators.py +22 -0
  255. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_static_var_compensator.py +24 -0
  256. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_switches.py +21 -0
  257. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_synchronous_machines.py +95 -0
  258. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_tap_changer_controls.py +28 -0
  259. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_tap_changers.py +25 -0
  260. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_transformer_ends.py +30 -0
  261. zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_transformer_star_impedances.py +32 -0
  262. zepben/ewb/database/sqlite/tables/iec61970/infiec61970/__init__.py +4 -0
  263. zepben/ewb/database/sqlite/tables/iec61970/infiec61970/feeder/__init__.py +4 -0
  264. zepben/ewb/database/sqlite/tables/iec61970/infiec61970/feeder/table_circuits.py +27 -0
  265. zepben/ewb/database/sqlite/tables/sqlite_table.py +142 -0
  266. zepben/ewb/database/sqlite/tables/table_metadata_data_sources.py +21 -0
  267. zepben/ewb/database/sqlite/tables/table_version.py +38 -0
  268. zepben/ewb/dataclassy/__init__.py +15 -0
  269. zepben/ewb/dataclassy/dataclass.py +192 -0
  270. zepben/ewb/dataclassy/decorator.py +35 -0
  271. zepben/ewb/dataclassy/functions.py +80 -0
  272. zepben/ewb/examples/__init__.py +6 -0
  273. zepben/ewb/examples/simple_test_network.py +158 -0
  274. zepben/ewb/exceptions.py +52 -0
  275. zepben/ewb/model/__init__.py +4 -0
  276. zepben/ewb/model/busbranch/__init__.py +4 -0
  277. zepben/ewb/model/busbranch/bus_branch.py +1051 -0
  278. zepben/ewb/model/cim/__init__.py +4 -0
  279. zepben/ewb/model/cim/extensions/__init__.py +4 -0
  280. zepben/ewb/model/cim/extensions/iec61968/__init__.py +4 -0
  281. zepben/ewb/model/cim/extensions/iec61968/assetinfo/__init__.py +4 -0
  282. zepben/ewb/model/cim/extensions/iec61968/assetinfo/relay_info.py +128 -0
  283. zepben/ewb/model/cim/extensions/iec61968/metering/__init__.py +4 -0
  284. zepben/ewb/model/cim/extensions/iec61968/metering/pan_demand_reponse_function.py +112 -0
  285. zepben/ewb/model/cim/extensions/iec61970/__init__.py +4 -0
  286. zepben/ewb/model/cim/extensions/iec61970/base/__init__.py +4 -0
  287. zepben/ewb/model/cim/extensions/iec61970/base/core/__init__.py +4 -0
  288. zepben/ewb/model/cim/extensions/iec61970/base/core/site.py +37 -0
  289. zepben/ewb/model/cim/extensions/iec61970/base/feeder/__init__.py +4 -0
  290. zepben/ewb/model/cim/extensions/iec61970/base/feeder/loop.py +207 -0
  291. zepben/ewb/model/cim/extensions/iec61970/base/feeder/lv_feeder.py +258 -0
  292. zepben/ewb/model/cim/extensions/iec61970/base/generation/__init__.py +4 -0
  293. zepben/ewb/model/cim/extensions/iec61970/base/generation/production/__init__.py +4 -0
  294. zepben/ewb/model/cim/extensions/iec61970/base/generation/production/ev_charging_unit.py +18 -0
  295. zepben/ewb/model/cim/extensions/iec61970/base/protection/__init__.py +4 -0
  296. zepben/ewb/model/cim/extensions/iec61970/base/protection/distance_relay.py +69 -0
  297. zepben/ewb/model/cim/extensions/iec61970/base/protection/power_direction_kind.py +35 -0
  298. zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_kind.py +113 -0
  299. zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_relay_function.py +448 -0
  300. zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_relay_scheme.py +97 -0
  301. zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_relay_system.py +97 -0
  302. zepben/ewb/model/cim/extensions/iec61970/base/protection/relay_setting.py +35 -0
  303. zepben/ewb/model/cim/extensions/iec61970/base/protection/voltage_relay.py +20 -0
  304. zepben/ewb/model/cim/extensions/iec61970/base/wires/__init__.py +4 -0
  305. zepben/ewb/model/cim/extensions/iec61970/base/wires/battery_control.py +36 -0
  306. zepben/ewb/model/cim/extensions/iec61970/base/wires/battery_control_mode.py +82 -0
  307. zepben/ewb/model/cim/extensions/iec61970/base/wires/transformer_cooling_type.py +56 -0
  308. zepben/ewb/model/cim/extensions/iec61970/base/wires/transformer_end_rated_s.py +26 -0
  309. zepben/ewb/model/cim/extensions/iec61970/base/wires/vector_group.py +292 -0
  310. zepben/ewb/model/cim/extensions/zbex.py +17 -0
  311. zepben/ewb/model/cim/iec61968/__init__.py +4 -0
  312. zepben/ewb/model/cim/iec61968/assetinfo/__init__.py +4 -0
  313. zepben/ewb/model/cim/iec61968/assetinfo/cable_info.py +15 -0
  314. zepben/ewb/model/cim/iec61968/assetinfo/no_load_test.py +42 -0
  315. zepben/ewb/model/cim/iec61968/assetinfo/open_circuit_test.py +42 -0
  316. zepben/ewb/model/cim/iec61968/assetinfo/overhead_wire_info.py +15 -0
  317. zepben/ewb/model/cim/iec61968/assetinfo/power_transformer_info.py +103 -0
  318. zepben/ewb/model/cim/iec61968/assetinfo/short_circuit_test.py +67 -0
  319. zepben/ewb/model/cim/iec61968/assetinfo/shunt_compensator_info.py +26 -0
  320. zepben/ewb/model/cim/iec61968/assetinfo/switch_info.py +17 -0
  321. zepben/ewb/model/cim/iec61968/assetinfo/transformer_end_info.py +137 -0
  322. zepben/ewb/model/cim/iec61968/assetinfo/transformer_tank_info.py +108 -0
  323. zepben/ewb/model/cim/iec61968/assetinfo/transformer_test.py +26 -0
  324. zepben/ewb/model/cim/iec61968/assetinfo/wire_info.py +24 -0
  325. zepben/ewb/model/cim/iec61968/assetinfo/wire_material_kind.py +55 -0
  326. zepben/ewb/model/cim/iec61968/assets/__init__.py +4 -0
  327. zepben/ewb/model/cim/iec61968/assets/asset.py +154 -0
  328. zepben/ewb/model/cim/iec61968/assets/asset_container.py +16 -0
  329. zepben/ewb/model/cim/iec61968/assets/asset_function.py +15 -0
  330. zepben/ewb/model/cim/iec61968/assets/asset_info.py +19 -0
  331. zepben/ewb/model/cim/iec61968/assets/asset_organisation_role.py +13 -0
  332. zepben/ewb/model/cim/iec61968/assets/asset_owner.py +13 -0
  333. zepben/ewb/model/cim/iec61968/assets/streetlight.py +29 -0
  334. zepben/ewb/model/cim/iec61968/assets/structure.py +16 -0
  335. zepben/ewb/model/cim/iec61968/common/__init__.py +4 -0
  336. zepben/ewb/model/cim/iec61968/common/agreement.py +16 -0
  337. zepben/ewb/model/cim/iec61968/common/document.py +36 -0
  338. zepben/ewb/model/cim/iec61968/common/location.py +129 -0
  339. zepben/ewb/model/cim/iec61968/common/organisation.py +15 -0
  340. zepben/ewb/model/cim/iec61968/common/organisation_role.py +22 -0
  341. zepben/ewb/model/cim/iec61968/common/position_point.py +44 -0
  342. zepben/ewb/model/cim/iec61968/common/street_address.py +28 -0
  343. zepben/ewb/model/cim/iec61968/common/street_detail.py +45 -0
  344. zepben/ewb/model/cim/iec61968/common/town_detail.py +25 -0
  345. zepben/ewb/model/cim/iec61968/customers/__init__.py +4 -0
  346. zepben/ewb/model/cim/iec61968/customers/customer.py +93 -0
  347. zepben/ewb/model/cim/iec61968/customers/customer_agreement.py +107 -0
  348. zepben/ewb/model/cim/iec61968/customers/customer_kind.py +67 -0
  349. zepben/ewb/model/cim/iec61968/customers/pricing_structure.py +88 -0
  350. zepben/ewb/model/cim/iec61968/customers/tariff.py +18 -0
  351. zepben/ewb/model/cim/iec61968/infiec61968/__init__.py +4 -0
  352. zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/__init__.py +4 -0
  353. zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/current_transformer_info.py +51 -0
  354. zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/potential_transformer_info.py +33 -0
  355. zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/transformer_construction_kind.py +67 -0
  356. zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/transformer_function_kind.py +43 -0
  357. zepben/ewb/model/cim/iec61968/infiec61968/infassets/__init__.py +4 -0
  358. zepben/ewb/model/cim/iec61968/infiec61968/infassets/pole.py +87 -0
  359. zepben/ewb/model/cim/iec61968/infiec61968/infassets/streetlight_lamp_kind.py +25 -0
  360. zepben/ewb/model/cim/iec61968/infiec61968/infcommon/__init__.py +4 -0
  361. zepben/ewb/model/cim/iec61968/infiec61968/infcommon/ratio.py +34 -0
  362. zepben/ewb/model/cim/iec61968/metering/__init__.py +4 -0
  363. zepben/ewb/model/cim/iec61968/metering/controlled_appliance.py +150 -0
  364. zepben/ewb/model/cim/iec61968/metering/end_device.py +165 -0
  365. zepben/ewb/model/cim/iec61968/metering/end_device_function.py +17 -0
  366. zepben/ewb/model/cim/iec61968/metering/end_device_function_kind.py +46 -0
  367. zepben/ewb/model/cim/iec61968/metering/meter.py +26 -0
  368. zepben/ewb/model/cim/iec61968/metering/usage_point.py +186 -0
  369. zepben/ewb/model/cim/iec61968/operations/__init__.py +4 -0
  370. zepben/ewb/model/cim/iec61968/operations/operational_restriction.py +92 -0
  371. zepben/ewb/model/cim/iec61970/__init__.py +4 -0
  372. zepben/ewb/model/cim/iec61970/base/__init__.py +4 -0
  373. zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/__init__.py +4 -0
  374. zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/auxiliary_equipment.py +24 -0
  375. zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/current_transformer.py +37 -0
  376. zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/fault_indicator.py +18 -0
  377. zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/potential_transformer.py +38 -0
  378. zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/potential_transformer_kind.py +28 -0
  379. zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/sensor.py +92 -0
  380. zepben/ewb/model/cim/iec61970/base/core/__init__.py +4 -0
  381. zepben/ewb/model/cim/iec61970/base/core/ac_dc_terminal.py +16 -0
  382. zepben/ewb/model/cim/iec61970/base/core/base_voltage.py +17 -0
  383. zepben/ewb/model/cim/iec61970/base/core/conducting_equipment.py +198 -0
  384. zepben/ewb/model/cim/iec61970/base/core/connectivity_node.py +105 -0
  385. zepben/ewb/model/cim/iec61970/base/core/connectivity_node_container.py +15 -0
  386. zepben/ewb/model/cim/iec61970/base/core/curve.py +124 -0
  387. zepben/ewb/model/cim/iec61970/base/core/curve_data.py +29 -0
  388. zepben/ewb/model/cim/iec61970/base/core/equipment.py +366 -0
  389. zepben/ewb/model/cim/iec61970/base/core/equipment_container.py +199 -0
  390. zepben/ewb/model/cim/iec61970/base/core/feeder.py +260 -0
  391. zepben/ewb/model/cim/iec61970/base/core/geographical_region.py +82 -0
  392. zepben/ewb/model/cim/iec61970/base/core/identified_object.py +234 -0
  393. zepben/ewb/model/cim/iec61970/base/core/name.py +36 -0
  394. zepben/ewb/model/cim/iec61970/base/core/name_type.py +203 -0
  395. zepben/ewb/model/cim/iec61970/base/core/phase_code.py +201 -0
  396. zepben/ewb/model/cim/iec61970/base/core/power_system_resource.py +106 -0
  397. zepben/ewb/model/cim/iec61970/base/core/sub_geographical_region.py +93 -0
  398. zepben/ewb/model/cim/iec61970/base/core/substation.py +277 -0
  399. zepben/ewb/model/cim/iec61970/base/core/terminal.py +171 -0
  400. zepben/ewb/model/cim/iec61970/base/diagramlayout/__init__.py +4 -0
  401. zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram.py +109 -0
  402. zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_object.py +160 -0
  403. zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_object_point.py +25 -0
  404. zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_style.py +26 -0
  405. zepben/ewb/model/cim/iec61970/base/diagramlayout/orientation_kind.py +27 -0
  406. zepben/ewb/model/cim/iec61970/base/domain/__init__.py +4 -0
  407. zepben/ewb/model/cim/iec61970/base/domain/unit_symbol.py +492 -0
  408. zepben/ewb/model/cim/iec61970/base/equivalents/__init__.py +4 -0
  409. zepben/ewb/model/cim/iec61970/base/equivalents/equivalent_branch.py +113 -0
  410. zepben/ewb/model/cim/iec61970/base/equivalents/equivalent_equipment.py +15 -0
  411. zepben/ewb/model/cim/iec61970/base/generation/__init__.py +4 -0
  412. zepben/ewb/model/cim/iec61970/base/generation/production/__init__.py +4 -0
  413. zepben/ewb/model/cim/iec61970/base/generation/production/battery_state_kind.py +37 -0
  414. zepben/ewb/model/cim/iec61970/base/generation/production/battery_unit.py +108 -0
  415. zepben/ewb/model/cim/iec61970/base/generation/production/photo_voltaic_unit.py +13 -0
  416. zepben/ewb/model/cim/iec61970/base/generation/production/power_electronics_unit.py +28 -0
  417. zepben/ewb/model/cim/iec61970/base/generation/production/power_electronics_wind_unit.py +13 -0
  418. zepben/ewb/model/cim/iec61970/base/meas/__init__.py +4 -0
  419. zepben/ewb/model/cim/iec61970/base/meas/accumulator.py +13 -0
  420. zepben/ewb/model/cim/iec61970/base/meas/accumulator_value.py +20 -0
  421. zepben/ewb/model/cim/iec61970/base/meas/analog.py +16 -0
  422. zepben/ewb/model/cim/iec61970/base/meas/analog_value.py +20 -0
  423. zepben/ewb/model/cim/iec61970/base/meas/control.py +26 -0
  424. zepben/ewb/model/cim/iec61970/base/meas/discrete.py +13 -0
  425. zepben/ewb/model/cim/iec61970/base/meas/discrete_value.py +20 -0
  426. zepben/ewb/model/cim/iec61970/base/meas/iopoint.py +16 -0
  427. zepben/ewb/model/cim/iec61970/base/meas/measurement.py +60 -0
  428. zepben/ewb/model/cim/iec61970/base/meas/measurement_value.py +21 -0
  429. zepben/ewb/model/cim/iec61970/base/protection/__init__.py +4 -0
  430. zepben/ewb/model/cim/iec61970/base/protection/current_relay.py +23 -0
  431. zepben/ewb/model/cim/iec61970/base/scada/__init__.py +4 -0
  432. zepben/ewb/model/cim/iec61970/base/scada/remote_control.py +22 -0
  433. zepben/ewb/model/cim/iec61970/base/scada/remote_point.py +16 -0
  434. zepben/ewb/model/cim/iec61970/base/scada/remote_source.py +22 -0
  435. zepben/ewb/model/cim/iec61970/base/wires/__init__.py +4 -0
  436. zepben/ewb/model/cim/iec61970/base/wires/ac_line_segment.py +214 -0
  437. zepben/ewb/model/cim/iec61970/base/wires/breaker.py +32 -0
  438. zepben/ewb/model/cim/iec61970/base/wires/busbar_section.py +19 -0
  439. zepben/ewb/model/cim/iec61970/base/wires/clamp.py +32 -0
  440. zepben/ewb/model/cim/iec61970/base/wires/conductor.py +49 -0
  441. zepben/ewb/model/cim/iec61970/base/wires/connector.py +16 -0
  442. zepben/ewb/model/cim/iec61970/base/wires/cut.py +36 -0
  443. zepben/ewb/model/cim/iec61970/base/wires/disconnector.py +17 -0
  444. zepben/ewb/model/cim/iec61970/base/wires/earth_fault_compensator.py +21 -0
  445. zepben/ewb/model/cim/iec61970/base/wires/energy_connection.py +15 -0
  446. zepben/ewb/model/cim/iec61970/base/wires/energy_consumer.py +107 -0
  447. zepben/ewb/model/cim/iec61970/base/wires/energy_consumer_phase.py +56 -0
  448. zepben/ewb/model/cim/iec61970/base/wires/energy_source.py +172 -0
  449. zepben/ewb/model/cim/iec61970/base/wires/energy_source_phase.py +45 -0
  450. zepben/ewb/model/cim/iec61970/base/wires/fuse.py +23 -0
  451. zepben/ewb/model/cim/iec61970/base/wires/ground.py +15 -0
  452. zepben/ewb/model/cim/iec61970/base/wires/ground_disconnector.py +15 -0
  453. zepben/ewb/model/cim/iec61970/base/wires/grounding_impedance.py +19 -0
  454. zepben/ewb/model/cim/iec61970/base/wires/jumper.py +16 -0
  455. zepben/ewb/model/cim/iec61970/base/wires/junction.py +15 -0
  456. zepben/ewb/model/cim/iec61970/base/wires/line.py +13 -0
  457. zepben/ewb/model/cim/iec61970/base/wires/linear_shunt_compensator.py +26 -0
  458. zepben/ewb/model/cim/iec61970/base/wires/load_break_switch.py +14 -0
  459. zepben/ewb/model/cim/iec61970/base/wires/per_length_impedance.py +13 -0
  460. zepben/ewb/model/cim/iec61970/base/wires/per_length_line_parameter.py +13 -0
  461. zepben/ewb/model/cim/iec61970/base/wires/per_length_phase_impedance.py +99 -0
  462. zepben/ewb/model/cim/iec61970/base/wires/per_length_sequence_impedance.py +43 -0
  463. zepben/ewb/model/cim/iec61970/base/wires/petersen_coil.py +22 -0
  464. zepben/ewb/model/cim/iec61970/base/wires/phase_impedance_data.py +37 -0
  465. zepben/ewb/model/cim/iec61970/base/wires/phase_shunt_connection_kind.py +38 -0
  466. zepben/ewb/model/cim/iec61970/base/wires/power_electronics_connection.py +524 -0
  467. zepben/ewb/model/cim/iec61970/base/wires/power_electronics_connection_phase.py +34 -0
  468. zepben/ewb/model/cim/iec61970/base/wires/power_transformer.py +217 -0
  469. zepben/ewb/model/cim/iec61970/base/wires/power_transformer_end.py +208 -0
  470. zepben/ewb/model/cim/iec61970/base/wires/protected_switch.py +96 -0
  471. zepben/ewb/model/cim/iec61970/base/wires/ratio_tap_changer.py +30 -0
  472. zepben/ewb/model/cim/iec61970/base/wires/reactive_capability_curve.py +16 -0
  473. zepben/ewb/model/cim/iec61970/base/wires/recloser.py +15 -0
  474. zepben/ewb/model/cim/iec61970/base/wires/regulating_cond_eq.py +45 -0
  475. zepben/ewb/model/cim/iec61970/base/wires/regulating_control.py +173 -0
  476. zepben/ewb/model/cim/iec61970/base/wires/regulating_control_mode_kind.py +46 -0
  477. zepben/ewb/model/cim/iec61970/base/wires/rotating_machine.py +36 -0
  478. zepben/ewb/model/cim/iec61970/base/wires/series_compensator.py +42 -0
  479. zepben/ewb/model/cim/iec61970/base/wires/shunt_compensator.py +59 -0
  480. zepben/ewb/model/cim/iec61970/base/wires/single_phase_kind.py +105 -0
  481. zepben/ewb/model/cim/iec61970/base/wires/static_var_compensator.py +40 -0
  482. zepben/ewb/model/cim/iec61970/base/wires/svc_control_mode.py +28 -0
  483. zepben/ewb/model/cim/iec61970/base/wires/switch.py +119 -0
  484. zepben/ewb/model/cim/iec61970/base/wires/synchronous_machine.py +168 -0
  485. zepben/ewb/model/cim/iec61970/base/wires/synchronous_machine_kind.py +44 -0
  486. zepben/ewb/model/cim/iec61970/base/wires/tap_changer.py +150 -0
  487. zepben/ewb/model/cim/iec61970/base/wires/tap_changer_control.py +49 -0
  488. zepben/ewb/model/cim/iec61970/base/wires/transformer_end.py +73 -0
  489. zepben/ewb/model/cim/iec61970/base/wires/transformer_star_impedance.py +48 -0
  490. zepben/ewb/model/cim/iec61970/base/wires/winding_connection.py +43 -0
  491. zepben/ewb/model/cim/iec61970/infiec61970/__init__.py +4 -0
  492. zepben/ewb/model/cim/iec61970/infiec61970/feeder/__init__.py +4 -0
  493. zepben/ewb/model/cim/iec61970/infiec61970/feeder/circuit.py +144 -0
  494. zepben/ewb/model/phases.py +168 -0
  495. zepben/ewb/model/resistance_reactance.py +40 -0
  496. zepben/ewb/services/__init__.py +4 -0
  497. zepben/ewb/services/common/__init__.py +16 -0
  498. zepben/ewb/services/common/base_service.py +383 -0
  499. zepben/ewb/services/common/base_service_comparator.py +394 -0
  500. zepben/ewb/services/common/difference.py +47 -0
  501. zepben/ewb/services/common/enum_mapper.py +55 -0
  502. zepben/ewb/services/common/meta/__init__.py +4 -0
  503. zepben/ewb/services/common/meta/data_source.py +16 -0
  504. zepben/ewb/services/common/meta/metadata_collection.py +28 -0
  505. zepben/ewb/services/common/meta/metadata_translations.py +47 -0
  506. zepben/ewb/services/common/meta/service_info.py +22 -0
  507. zepben/ewb/services/common/reference_resolvers.py +374 -0
  508. zepben/ewb/services/common/resolver.py +597 -0
  509. zepben/ewb/services/common/translator/__init__.py +4 -0
  510. zepben/ewb/services/common/translator/base_cim2proto.py +92 -0
  511. zepben/ewb/services/common/translator/base_proto2cim.py +112 -0
  512. zepben/ewb/services/common/translator/service_differences.py +81 -0
  513. zepben/ewb/services/common/translator/util.py +78 -0
  514. zepben/ewb/services/customer/__init__.py +4 -0
  515. zepben/ewb/services/customer/customer_service_comparator.py +52 -0
  516. zepben/ewb/services/customer/customers.py +23 -0
  517. zepben/ewb/services/customer/translator/__init__.py +21 -0
  518. zepben/ewb/services/customer/translator/customer_cim2proto.py +71 -0
  519. zepben/ewb/services/customer/translator/customer_enum_mappers.py +18 -0
  520. zepben/ewb/services/customer/translator/customer_proto2cim.py +87 -0
  521. zepben/ewb/services/diagram/__init__.py +4 -0
  522. zepben/ewb/services/diagram/diagram_service_comparator.py +39 -0
  523. zepben/ewb/services/diagram/diagrams.py +107 -0
  524. zepben/ewb/services/diagram/translator/__init__.py +11 -0
  525. zepben/ewb/services/diagram/translator/diagram_cim2proto.py +51 -0
  526. zepben/ewb/services/diagram/translator/diagram_enum_mappers.py +21 -0
  527. zepben/ewb/services/diagram/translator/diagram_proto2cim.py +61 -0
  528. zepben/ewb/services/measurement/__init__.py +4 -0
  529. zepben/ewb/services/measurement/measurements.py +35 -0
  530. zepben/ewb/services/measurement/translator/__init__.py +6 -0
  531. zepben/ewb/services/measurement/translator/measurement_cim2proto.py +42 -0
  532. zepben/ewb/services/measurement/translator/measurement_proto2cim.py +52 -0
  533. zepben/ewb/services/network/__init__.py +4 -0
  534. zepben/ewb/services/network/network_extensions.py +119 -0
  535. zepben/ewb/services/network/network_service.py +302 -0
  536. zepben/ewb/services/network/network_service_comparator.py +1322 -0
  537. zepben/ewb/services/network/network_state.py +34 -0
  538. zepben/ewb/services/network/tracing/__init__.py +4 -0
  539. zepben/ewb/services/network/tracing/busbranch_trace.py +36 -0
  540. zepben/ewb/services/network/tracing/connectivity/__init__.py +4 -0
  541. zepben/ewb/services/network/tracing/connectivity/connectivity_result.py +105 -0
  542. zepben/ewb/services/network/tracing/connectivity/nominal_phase_path.py +23 -0
  543. zepben/ewb/services/network/tracing/connectivity/phase_paths.py +70 -0
  544. zepben/ewb/services/network/tracing/connectivity/terminal_connectivity_connected.py +226 -0
  545. zepben/ewb/services/network/tracing/connectivity/terminal_connectivity_internal.py +64 -0
  546. zepben/ewb/services/network/tracing/connectivity/transformer_phase_paths.py +202 -0
  547. zepben/ewb/services/network/tracing/connectivity/xy_candidate_phase_paths.py +235 -0
  548. zepben/ewb/services/network/tracing/connectivity/xy_phase_step.py +24 -0
  549. zepben/ewb/services/network/tracing/feeder/__init__.py +4 -0
  550. zepben/ewb/services/network/tracing/feeder/assign_to_feeders.py +202 -0
  551. zepben/ewb/services/network/tracing/feeder/assign_to_lv_feeders.py +202 -0
  552. zepben/ewb/services/network/tracing/feeder/clear_direction.py +80 -0
  553. zepben/ewb/services/network/tracing/feeder/direction_status.py +133 -0
  554. zepben/ewb/services/network/tracing/feeder/feeder_direction.py +107 -0
  555. zepben/ewb/services/network/tracing/feeder/set_direction.py +143 -0
  556. zepben/ewb/services/network/tracing/find_swer_equipment.py +175 -0
  557. zepben/ewb/services/network/tracing/networktrace/__init__.py +4 -0
  558. zepben/ewb/services/network/tracing/networktrace/actions/__init__.py +4 -0
  559. zepben/ewb/services/network/tracing/networktrace/actions/equipment_tree_builder.py +71 -0
  560. zepben/ewb/services/network/tracing/networktrace/actions/tree_node.py +37 -0
  561. zepben/ewb/services/network/tracing/networktrace/compute_data.py +60 -0
  562. zepben/ewb/services/network/tracing/networktrace/conditions/__init__.py +4 -0
  563. zepben/ewb/services/network/tracing/networktrace/conditions/conditions.py +73 -0
  564. zepben/ewb/services/network/tracing/networktrace/conditions/direction_condition.py +63 -0
  565. zepben/ewb/services/network/tracing/networktrace/conditions/equipment_step_limit_condition.py +26 -0
  566. zepben/ewb/services/network/tracing/networktrace/conditions/equipment_type_step_limit_condition.py +44 -0
  567. zepben/ewb/services/network/tracing/networktrace/conditions/network_trace_queue_condition.py +67 -0
  568. zepben/ewb/services/network/tracing/networktrace/conditions/network_trace_stop_condition.py +65 -0
  569. zepben/ewb/services/network/tracing/networktrace/conditions/open_condition.py +39 -0
  570. zepben/ewb/services/network/tracing/networktrace/network_trace.py +450 -0
  571. zepben/ewb/services/network/tracing/networktrace/network_trace_action_type.py +42 -0
  572. zepben/ewb/services/network/tracing/networktrace/network_trace_queue_next.py +84 -0
  573. zepben/ewb/services/network/tracing/networktrace/network_trace_step.py +125 -0
  574. zepben/ewb/services/network/tracing/networktrace/network_trace_step_path_provider.py +351 -0
  575. zepben/ewb/services/network/tracing/networktrace/network_trace_tracker.py +39 -0
  576. zepben/ewb/services/network/tracing/networktrace/operators/__init__.py +14 -0
  577. zepben/ewb/services/network/tracing/networktrace/operators/equipment_container_state_operators.py +264 -0
  578. zepben/ewb/services/network/tracing/networktrace/operators/feeder_direction_state_operations.py +181 -0
  579. zepben/ewb/services/network/tracing/networktrace/operators/in_service_state_operators.py +76 -0
  580. zepben/ewb/services/network/tracing/networktrace/operators/network_state_operators.py +120 -0
  581. zepben/ewb/services/network/tracing/networktrace/operators/open_state_operators.py +104 -0
  582. zepben/ewb/services/network/tracing/networktrace/operators/phase_state_operators.py +56 -0
  583. zepben/ewb/services/network/tracing/networktrace/tracing.py +132 -0
  584. zepben/ewb/services/network/tracing/phases/__init__.py +4 -0
  585. zepben/ewb/services/network/tracing/phases/phase_inferrer.py +205 -0
  586. zepben/ewb/services/network/tracing/phases/phase_status.py +101 -0
  587. zepben/ewb/services/network/tracing/phases/remove_phases.py +143 -0
  588. zepben/ewb/services/network/tracing/phases/set_phases.py +490 -0
  589. zepben/ewb/services/network/tracing/traversal/__init__.py +4 -0
  590. zepben/ewb/services/network/tracing/traversal/context_value_computer.py +63 -0
  591. zepben/ewb/services/network/tracing/traversal/debug_logging.py +124 -0
  592. zepben/ewb/services/network/tracing/traversal/queue.py +112 -0
  593. zepben/ewb/services/network/tracing/traversal/queue_condition.py +75 -0
  594. zepben/ewb/services/network/tracing/traversal/step_action.py +83 -0
  595. zepben/ewb/services/network/tracing/traversal/step_context.py +59 -0
  596. zepben/ewb/services/network/tracing/traversal/stop_condition.py +57 -0
  597. zepben/ewb/services/network/tracing/traversal/traversal.py +634 -0
  598. zepben/ewb/services/network/tracing/traversal/traversal_condition.py +22 -0
  599. zepben/ewb/services/network/tracing/traversal/weighted_priority_queue.py +85 -0
  600. zepben/ewb/services/network/tracing/util.py +93 -0
  601. zepben/ewb/services/network/translator/__init__.py +392 -0
  602. zepben/ewb/services/network/translator/network_cim2proto.py +1782 -0
  603. zepben/ewb/services/network/translator/network_enum_mappers.py +78 -0
  604. zepben/ewb/services/network/translator/network_proto2cim.py +2147 -0
  605. zepben/ewb/services/services.py +48 -0
  606. zepben/ewb/streaming/__init__.py +4 -0
  607. zepben/ewb/streaming/data/__init__.py +4 -0
  608. zepben/ewb/streaming/data/current_state_event.py +314 -0
  609. zepben/ewb/streaming/data/current_state_event_batch.py +25 -0
  610. zepben/ewb/streaming/data/set_current_states_status.py +286 -0
  611. zepben/ewb/streaming/exceptions.py +14 -0
  612. zepben/ewb/streaming/get/__init__.py +4 -0
  613. zepben/ewb/streaming/get/consumer.py +209 -0
  614. zepben/ewb/streaming/get/customer_consumer.py +111 -0
  615. zepben/ewb/streaming/get/diagram_consumer.py +107 -0
  616. zepben/ewb/streaming/get/hierarchy/__init__.py +4 -0
  617. zepben/ewb/streaming/get/hierarchy/data.py +27 -0
  618. zepben/ewb/streaming/get/included_energized_containers.py +34 -0
  619. zepben/ewb/streaming/get/included_energizing_containers.py +34 -0
  620. zepben/ewb/streaming/get/network_consumer.py +870 -0
  621. zepben/ewb/streaming/get/query_network_state_client.py +64 -0
  622. zepben/ewb/streaming/get/query_network_state_service.py +94 -0
  623. zepben/ewb/streaming/grpc/__init__.py +4 -0
  624. zepben/ewb/streaming/grpc/auth_token_plugin.py +24 -0
  625. zepben/ewb/streaming/grpc/connect.py +209 -0
  626. zepben/ewb/streaming/grpc/grpc.py +107 -0
  627. zepben/ewb/streaming/grpc/grpc_channel_builder.py +185 -0
  628. zepben/ewb/streaming/mutations/__init__.py +4 -0
  629. zepben/ewb/streaming/mutations/update_network_state_client.py +80 -0
  630. zepben/ewb/streaming/mutations/update_network_state_service.py +61 -0
  631. zepben/ewb/testing/__init__.py +4 -0
  632. zepben/ewb/testing/test_network_builder.py +816 -0
  633. zepben/ewb/types.py +17 -0
  634. zepben/ewb/util.py +189 -0
  635. zepben_ewb-1.0.0b1.dist-info/METADATA +102 -0
  636. zepben_ewb-1.0.0b1.dist-info/RECORD +639 -0
  637. zepben_ewb-1.0.0b1.dist-info/WHEEL +5 -0
  638. zepben_ewb-1.0.0b1.dist-info/licenses/LICENSE +374 -0
  639. zepben_ewb-1.0.0b1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,870 @@
1
+ # Copyright 2024 Zeppelin Bend Pty Ltd
2
+ # This Source Code Form is subject to the terms of the Mozilla Public
3
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+
6
+ from __future__ import annotations
7
+
8
+ __all__ = ["NetworkConsumerClient", "SyncNetworkConsumerClient"]
9
+
10
+ import warnings
11
+ from asyncio import get_event_loop
12
+ from itertools import chain
13
+ from typing import Iterable, Dict, Optional, AsyncGenerator, Union, List, Callable, Set, Tuple, Generic, TypeVar, Awaitable, cast
14
+
15
+ from zepben.protobuf.metadata.metadata_requests_pb2 import GetMetadataRequest
16
+ from zepben.protobuf.metadata.metadata_responses_pb2 import GetMetadataResponse
17
+ from zepben.protobuf.nc.nc_pb2_grpc import NetworkConsumerStub
18
+ from zepben.protobuf.nc.nc_requests_pb2 import GetIdentifiedObjectsRequest, GetNetworkHierarchyRequest, GetEquipmentForContainersRequest, \
19
+ GetEquipmentForRestrictionRequest, GetTerminalsForNodeRequest, IncludedEnergizingContainers as PBIncludedEnergizingContainers, \
20
+ IncludedEnergizedContainers as PBIncludedEnergizedContainers, NetworkState as PBNetworkState
21
+
22
+ from zepben.ewb import NetworkService, IdentifiedObject, Organisation, Location, OperationalRestriction, BaseVoltage, ConnectivityNode, Substation, Terminal, \
23
+ AcLineSegment, Breaker, Disconnector, EnergyConsumer, \
24
+ EnergySource, EnergySourcePhase, \
25
+ Fuse, Jumper, PowerTransformer, Recloser, Circuit, \
26
+ Loop, Pole, Streetlight, Control, RemoteControl, RemoteSource, PowerTransformerInfo, PowerElectronicsConnection, \
27
+ BatteryUnit, PhotoVoltaicUnit, PowerElectronicsWindUnit, LoadBreakSwitch, TransformerTankInfo, \
28
+ TransformerEndInfo, TransformerStarImpedance, EquipmentContainer, NetworkHierarchy, MultiObjectResult, CimConsumerClient, NoLoadTest, OpenCircuitTest, \
29
+ ShortCircuitTest, EquivalentBranch, ShuntCompensatorInfo, LvFeeder, CurrentRelay, CurrentTransformer, RelayInfo, SwitchInfo, \
30
+ CurrentTransformerInfo, EvChargingUnit, TapChangerControl, ServiceInfo, PotentialTransformer, DistanceRelay, VoltageRelay, ProtectionRelayScheme, \
31
+ ProtectionRelaySystem, GroundDisconnector, Ground, SeriesCompensator, PotentialTransformerInfo, PanDemandResponseFunction, BatteryControl, \
32
+ StaticVarCompensator, PerLengthPhaseImpedance, GroundingImpedance, PetersenCoil, ReactiveCapabilityCurve, SynchronousMachine, PowerSystemResource, Asset
33
+ from zepben.ewb.dataclassy import dataclass
34
+ from zepben.ewb.model.cim.extensions.iec61970.base.core.site import Site
35
+ from zepben.ewb.model.cim.iec61968.assetinfo.cable_info import CableInfo
36
+ from zepben.ewb.model.cim.iec61968.assetinfo.overhead_wire_info import OverheadWireInfo
37
+ from zepben.ewb.model.cim.iec61968.assets.asset_owner import AssetOwner
38
+ from zepben.ewb.model.cim.iec61968.metering.meter import Meter
39
+ from zepben.ewb.model.cim.iec61968.metering.usage_point import UsagePoint
40
+ from zepben.ewb.model.cim.iec61970.base.auxiliaryequipment.fault_indicator import FaultIndicator
41
+ from zepben.ewb.model.cim.iec61970.base.core.feeder import Feeder
42
+ from zepben.ewb.model.cim.iec61970.base.core.geographical_region import GeographicalRegion
43
+ from zepben.ewb.model.cim.iec61970.base.core.sub_geographical_region import SubGeographicalRegion
44
+ from zepben.ewb.model.cim.iec61970.base.meas.accumulator import Accumulator
45
+ from zepben.ewb.model.cim.iec61970.base.meas.analog import Analog
46
+ from zepben.ewb.model.cim.iec61970.base.meas.discrete import Discrete
47
+ from zepben.ewb.model.cim.iec61970.base.wires.busbar_section import BusbarSection
48
+ from zepben.ewb.model.cim.iec61970.base.wires.clamp import Clamp
49
+ from zepben.ewb.model.cim.iec61970.base.wires.cut import Cut
50
+ from zepben.ewb.model.cim.iec61970.base.wires.energy_consumer_phase import EnergyConsumerPhase
51
+ from zepben.ewb.model.cim.iec61970.base.wires.junction import Junction
52
+ from zepben.ewb.model.cim.iec61970.base.wires.linear_shunt_compensator import LinearShuntCompensator
53
+ from zepben.ewb.model.cim.iec61970.base.wires.per_length_sequence_impedance import PerLengthSequenceImpedance
54
+ from zepben.ewb.model.cim.iec61970.base.wires.power_electronics_connection_phase import PowerElectronicsConnectionPhase
55
+ from zepben.ewb.model.cim.iec61970.base.wires.power_transformer_end import PowerTransformerEnd
56
+ from zepben.ewb.model.cim.iec61970.base.wires.ratio_tap_changer import RatioTapChanger
57
+ # noinspection PyProtectedMember
58
+ from zepben.ewb.services.common.enum_mapper import EnumMapper
59
+ from zepben.ewb.services.network.network_state import NetworkState
60
+ from zepben.ewb.streaming.get.included_energized_containers import IncludedEnergizedContainers
61
+ from zepben.ewb.streaming.get.included_energizing_containers import IncludedEnergizingContainers
62
+ from zepben.ewb.streaming.grpc.grpc import GrpcResult
63
+
64
+ MAX_64_BIT_INTEGER = 9223372036854775807
65
+
66
+
67
+ @dataclass(slots=True)
68
+ class NetworkResult(object):
69
+ network_service: Optional[NetworkService]
70
+ failed: Set[str] = set()
71
+
72
+
73
+ _map_include_energizing_containers = EnumMapper(IncludedEnergizingContainers, PBIncludedEnergizingContainers)
74
+ _map_include_energized_containers = EnumMapper(IncludedEnergizedContainers, PBIncludedEnergizedContainers)
75
+ _map_network_state = EnumMapper(NetworkState, PBNetworkState)
76
+
77
+
78
+ class NetworkConsumerClient(CimConsumerClient[NetworkService]):
79
+ """
80
+ Consumer client for a :class:`NetworkService`.
81
+
82
+ ## WARNING ##
83
+ The :class:`MultiObjectResult` operations below are not atomic upon a :class:`NetworkService`, and thus if processing fails partway through, any
84
+ previously successful additions will have been processed by the service, and thus you may have an incomplete service. Also note that adding to the
85
+ service may not occur for an object if another object with the same mRID is already present in service. `MultiObjectResult.failed` can be used to
86
+ check for mRIDs that were not found or retrieved but not added to service (this should not be the case unless you are processing things concurrently).
87
+ """
88
+
89
+ CIM_IO = TypeVar('CIM_IO', bound=IdentifiedObject)
90
+ PB_IO = TypeVar('PB_IO')
91
+
92
+ __service: NetworkService
93
+ __network_hierarchy: Optional[NetworkHierarchy]
94
+
95
+ @property
96
+ def service(self) -> NetworkService:
97
+ return self.__service
98
+
99
+ _stub: NetworkConsumerStub = None
100
+
101
+ def __init__(self, channel=None, stub: NetworkConsumerStub = None, error_handlers: List[Callable[[Exception], bool]] = None, timeout: int = 60):
102
+ """
103
+ :param channel: a gRPC channel used to create a stub if no stub is provided.
104
+ :param stub: the gRPC stub to use for this consumer client.
105
+ :param error_handlers: a collection of handlers to be processed for any errors that occur.
106
+ """
107
+ super().__init__(error_handlers=error_handlers, timeout=timeout)
108
+ if channel is None and stub is None:
109
+ raise ValueError("Must provide either a channel or a stub")
110
+ if stub is not None:
111
+ self._stub = stub
112
+ else:
113
+ self._stub = NetworkConsumerStub(channel)
114
+
115
+ self.__service = NetworkService()
116
+ self.__network_hierarchy = None
117
+
118
+ async def get_equipment_for_container(
119
+ self,
120
+ container: Union[str, EquipmentContainer],
121
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
122
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
123
+ network_state: NetworkState = NetworkState.NORMAL
124
+ ) -> GrpcResult[MultiObjectResult]:
125
+ """
126
+ Retrieve the :class:`Equipment` for the :class:`EquipmentContainer` represented by `container`
127
+
128
+ Exceptions that occur during retrieval will be caught and passed to all error handlers that have been registered against this client.
129
+
130
+ Parameters
131
+ - `container` - The :class:`EquipmentContainer` (or its mRID) to fetch equipment for.
132
+ - `include_energizing_containers` - The level of energizing containers to include equipment from.
133
+ - `include_energized_containers` - The level of energized containers to include equipment from.
134
+ - `network_state` - The network state of the equipment.
135
+
136
+ Returns a :class:`GrpcResult` with a result of one of the following:
137
+ - When `GrpcResult.wasSuccessful`, a map containing the retrieved objects keyed by mRID, accessible via `GrpcResult.value`. If an item was not
138
+ found, or couldn't be added to `service`, it will be excluded from the map and its mRID will be present in `MultiObjectResult.failed` (see
139
+ `BaseService.add`).
140
+ - When `GrpcResult.wasFailure`, the error that occurred retrieving or processing the object, accessible via `GrpcResult.thrown`.
141
+
142
+ Note the :class:`NetworkConsumerClient` warning in this case.
143
+ """
144
+ return await self._get_equipment_for_container(container, include_energizing_containers, include_energized_containers, network_state)
145
+
146
+ async def get_equipment_for_containers(
147
+ self,
148
+ containers: Iterable[str],
149
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
150
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
151
+ network_state: NetworkState = NetworkState.NORMAL
152
+ ):
153
+ """
154
+ Retrieve the :class:`Equipment` for the :class:`EquipmentContainer`'s represented in `containers`
155
+
156
+ Exceptions that occur during retrieval will be caught and passed to all error handlers that have been registered against this client.
157
+
158
+ Parameters
159
+ - `containers` - The mRIDs of :class:`EquipmentContainer`'s to fetch equipment for.
160
+ - `include_energizing_containers` - The level of energizing containers to include equipment from.
161
+ - `include_energized_containers` - The level of energized containers to include equipment from.
162
+ - `network_state` - The network state of the equipment.
163
+
164
+ Returns a :class:`GrpcResult` with a result of one of the following:
165
+ - When `GrpcResult.wasSuccessful`, a map containing the retrieved objects keyed by mRID, accessible via `GrpcResult.value`. If an item was not
166
+ found, or couldn't be added to `service`, it will be excluded from the map and its mRID will be present in `MultiObjectResult.failed` (see
167
+ `BaseService.add`).
168
+ - When `GrpcResult.wasFailure`, the error that occurred retrieving or processing the object, accessible via `GrpcResult.thrown`.
169
+
170
+ Note the :class:`NetworkConsumerClient` warning in this case.
171
+ """
172
+ return await self._get_equipment_for_containers(containers, include_energizing_containers, include_energized_containers, network_state)
173
+
174
+ async def get_equipment_for_restriction(self, restriction: [str, OperationalRestriction]) -> GrpcResult[MultiObjectResult]:
175
+ """
176
+ Retrieve the :class:`Equipment` for the :class:`OperationalRestriction` represented by `restriction`
177
+
178
+ Exceptions that occur during retrieval will be caught and passed to all error handlers that have been registered against this client.
179
+
180
+ Parameters
181
+ - `service` - The :class:`NetworkService` to store fetched objects in.
182
+ - `restriction` - The :class:`OperationalRestriction` (or its mRID) to fetch equipment for.
183
+
184
+ Returns a :class:`GrpcResult` with a result of one of the following:
185
+ - When `GrpcResult.wasSuccessful`, a map containing the retrieved objects keyed by mRID, accessible via `GrpcResult.value`. If an item was not
186
+ found, or couldn't be added to `service`, it will be excluded from the map and its mRID will be present in `MultiObjectResult.failed` (see
187
+ `BaseService.add`).
188
+ - When `GrpcResult.wasFailure`, the error that occurred retrieving or processing the object, accessible via `GrpcResult.thrown`.
189
+
190
+ Note the :class:`NetworkConsumerClient` warning in this case.
191
+ """
192
+ return await self._get_equipment_for_restriction(restriction)
193
+
194
+ async def get_terminals_for_connectivity_node(self, node: [str, ConnectivityNode]) -> GrpcResult[MultiObjectResult]:
195
+ """
196
+ Retrieve the :class:`Terminal`s for the :class:`ConnectivityNode` represented by `node`
197
+
198
+ Exceptions that occur during retrieval will be caught and passed to all error handlers that have been registered against this client.
199
+
200
+ Parameters
201
+ - `service` - The :class:`NetworkService` to store fetched objects in.
202
+ - `node` - The :class:`ConnectivityNode` (or its mRID) to fetch terminals for.
203
+
204
+ Returns a :class:`GrpcResult` with a result of one of the following:
205
+ - When `GrpcResult.wasSuccessful`, a map containing the retrieved objects keyed by mRID, accessible via `GrpcResult.value`. If an item was not
206
+ found, or couldn't be added to `service`, it will be excluded from the map and its mRID will be present in `MultiObjectResult.failed` (see
207
+ `BaseService.add`).
208
+ - When `GrpcResult.wasFailure`, the error that occurred retrieving or processing the object, accessible via `GrpcResult.thrown`.
209
+
210
+ Note the :class:`NetworkConsumerClient` warning in this case.
211
+ """
212
+ return await self._get_terminals_for_connectivity_node(node)
213
+
214
+ async def get_network_hierarchy(self) -> GrpcResult[NetworkHierarchy]:
215
+ """
216
+ Retrieve the network hierarchy
217
+
218
+ Parameters
219
+ - `service` - The :class:`NetworkService` to store fetched objects in.
220
+
221
+ Returns a simplified version of the network hierarchy that can be used to make further in-depth requests.
222
+ """
223
+ return await self._get_network_hierarchy()
224
+
225
+ async def _run_get_metadata(self, request: GetMetadataRequest) -> GetMetadataResponse:
226
+ return await self._stub.getMetadata(request, timeout=self.timeout)
227
+
228
+ async def get_equipment_container(
229
+ self,
230
+ mrid: str,
231
+ expected_class: type = EquipmentContainer,
232
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
233
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
234
+ network_state: NetworkState = NetworkState.NORMAL
235
+ ) -> GrpcResult[MultiObjectResult]:
236
+ """
237
+ Retrieve the equipment container network for the specified `mrid` and store the results in the `service`.
238
+
239
+ This is a convenience method that will fetch the container object and all of the equipment contained, along with all subsequent
240
+ references. This should entail a complete connectivity model for the container, however not the connectivity between multiple containers.
241
+
242
+ Parameters
243
+ - `mrid` - The mRID of the :class:`EquipmentContainer` to fetch.
244
+ - `expected_class` - The expected type of the fetched container.
245
+ - `include_energizing_containers` - The level of energizing containers to include equipment from.
246
+ - `include_energized_containers` - The level of energized containers to include equipment from.
247
+ - `network_state` - The network state of the equipment.
248
+
249
+ Returns a :class:`GrpcResult` of a :class:`MultiObjectResult`. If successful, containing a map keyed by mRID of all the objects retrieved. If an
250
+ item couldn't be added to `service`, its mRID will be present in `MultiObjectResult.failed`.
251
+
252
+ In addition to normal gRPC errors, you may also receive an unsuccessful :class:`GrpcResult` with the following errors:
253
+ - :class:`ValueError` if the requested object was not found or was of the wrong type.
254
+
255
+ """
256
+ return await self._get_equipment_container(mrid, expected_class, include_energizing_containers, include_energized_containers, network_state)
257
+
258
+ async def get_equipment_for_loop(self, loop: Union[str, Loop], network_state: NetworkState = NetworkState.NORMAL) -> GrpcResult[
259
+ MultiObjectResult]:
260
+ """
261
+ Retrieve the :class:`Equipment` for the :class:`Loop` represented by `mRID`
262
+
263
+ Exceptions that occur during retrieval will be caught and passed to all error handlers that have been registered against this client.
264
+
265
+ Parameters
266
+ - `service` - The :class:`NetworkService` to store fetched objects in.
267
+ - `restriction` - The :class:`Loop` (or its mRID) to fetch equipment for.
268
+ - `network_state` - The network state of the equipment.
269
+
270
+ Returns a :class:`GrpcResult` with a result of one of the following:
271
+ - When `GrpcResult.wasSuccessful`, a map containing the retrieved objects keyed by mRID, accessible via `GrpcResult.value`. If an item was not
272
+ found, or couldn't be added to `service`, it will be excluded from the map and its mRID will be present in `MultiObjectResult.failed` (see
273
+ `BaseService.add`).
274
+ - When `GrpcResult.wasFailure`, the error that occurred retrieving or processing the object, accessible via `GrpcResult.thrown`.
275
+
276
+ Note the :class:`NetworkConsumerClient` warning in this case.
277
+ """
278
+ return await self._get_equipment_for_loop(loop, network_state)
279
+
280
+ async def get_all_loops(self, network_state: NetworkState = NetworkState.NORMAL) -> GrpcResult[MultiObjectResult]:
281
+ """
282
+ Retrieve the :class:`Equipment` for all :class:`Loop` instances in `service`.
283
+
284
+ Exceptions that occur during retrieval will be caught and passed to all error handlers that have been registered against this client.
285
+
286
+ Parameters
287
+ - `service` - The :class:`NetworkService` to store fetched objects in.
288
+ - `network_state` - The network state of the equipment.
289
+
290
+ Returns a :class:`GrpcResult` with a result of one of the following:
291
+ - When `GrpcResult.wasSuccessful`, a map containing the retrieved objects keyed by mRID, accessible via `GrpcResult.value`. If an item was not
292
+ found, or couldn't be added to `service`, it will be excluded from the map and its mRID will be present in `MultiObjectResult.failed` (see
293
+ `BaseService.add`).
294
+ - When `GrpcResult.wasFailure`, the error that occurred retrieving or processing the object, accessible via `GrpcResult.thrown`.
295
+
296
+ Note the :class:`NetworkConsumerClient` warning in this case.
297
+ """
298
+ return await self._get_all_loops(network_state)
299
+
300
+ async def retrieve_network(self) -> GrpcResult[NetworkResult]:
301
+ """
302
+ Retrieve the entire network.
303
+ Returns a GrpcResult containing the complete `NetworkService` from the server.
304
+ """
305
+ return await self._retrieve_network()
306
+
307
+ async def _get_equipment_for_container(
308
+ self,
309
+ container: Union[str, EquipmentContainer],
310
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
311
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
312
+ network_state: NetworkState = NetworkState.NORMAL
313
+ ) -> GrpcResult[MultiObjectResult]:
314
+ return await self._handle_multi_object_rpc(
315
+ lambda: self._process_equipment_for_container(container, include_energizing_containers, include_energized_containers, network_state)
316
+ )
317
+
318
+ async def _get_equipment_for_containers(
319
+ self,
320
+ containers: Iterable[str],
321
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
322
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
323
+ network_state: NetworkState = NetworkState.NORMAL
324
+ ) -> GrpcResult[MultiObjectResult]:
325
+ return await self._handle_multi_object_rpc(
326
+ lambda: self._process_equipment_for_containers(containers, include_energizing_containers, include_energized_containers, network_state)
327
+ )
328
+
329
+ async def _get_equipment_for_restriction(self, restriction: [str, OperationalRestriction]) -> GrpcResult[MultiObjectResult]:
330
+ return await self._handle_multi_object_rpc(lambda: self._process_equipment_for_restriction(restriction))
331
+
332
+ async def _get_terminals_for_connectivity_node(self, node: [str, ConnectivityNode]) -> GrpcResult[MultiObjectResult]:
333
+ return await self._handle_multi_object_rpc(lambda: self._process_terminals_for_connectivity_node(node))
334
+
335
+ async def _get_network_hierarchy(self) -> GrpcResult[NetworkHierarchy]:
336
+ if self.__network_hierarchy:
337
+ # noinspection PyArgumentList
338
+ return GrpcResult(self.__network_hierarchy)
339
+ return await self.try_rpc(lambda: self._handle_network_hierarchy())
340
+
341
+ async def _get_equipment_container(
342
+ self,
343
+ mrid: str,
344
+ expected_class: type = EquipmentContainer,
345
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
346
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
347
+ network_state: NetworkState = NetworkState.NORMAL
348
+ ) -> GrpcResult[MultiObjectResult]:
349
+ async def get_additional(it: EquipmentContainer, mor: MultiObjectResult) -> Optional[GrpcResult[MultiObjectResult]]:
350
+ result = await self._get_equipment_for_container(it, include_energizing_containers, include_energized_containers, network_state)
351
+
352
+ if result.was_failure:
353
+ # noinspection PyArgumentList
354
+ return GrpcResult(result.thrown, result.was_error_handled)
355
+
356
+ mor.objects.update(result.value.objects)
357
+ return None
358
+
359
+ return await self._get_with_references(mrid, expected_class, get_additional)
360
+
361
+ async def _get_equipment_for_loop(self, loop: Union[str, Loop], network_state: NetworkState = NetworkState.NORMAL) -> GrpcResult[
362
+ MultiObjectResult]:
363
+ mrid = loop.mrid if isinstance(loop, Loop) else loop
364
+
365
+ async def get_additional(it: Loop, mor: MultiObjectResult) -> Optional[GrpcResult[MultiObjectResult]]:
366
+ mor.objects.update({cir.mrid: cir for cir in it.circuits})
367
+ mor.objects.update({sub.mrid: sub for sub in it.substations})
368
+ mor.objects.update({sub.mrid: sub for sub in it.energizing_substations})
369
+
370
+ # `chain` infers the type as Circuit instead of EquipmentContainer, so provide a wrapper that forces the correct type.
371
+ def chain_typed(*iterables: Iterable[EquipmentContainer]): return chain(*iterables)
372
+
373
+ containers: Set[str] = {ec.mrid for ec in chain_typed(it.circuits, it.substations, it.energizing_substations)}
374
+ result = await self._get_equipment_for_containers(containers, network_state=network_state)
375
+ if result.was_failure:
376
+ # noinspection PyArgumentList
377
+ return GrpcResult(result.thrown, result.was_error_handled)
378
+
379
+ mor.objects.update(result.value.objects)
380
+
381
+ return None
382
+
383
+ return await self._get_with_references(mrid, Loop, get_additional)
384
+
385
+ async def _get_all_loops(self, network_state: NetworkState = NetworkState.NORMAL) -> GrpcResult[MultiObjectResult]:
386
+ response = await self._get_network_hierarchy()
387
+ if response.was_failure:
388
+ # noinspection PyArgumentList
389
+ return GrpcResult(response.thrown, response.was_error_handled)
390
+
391
+ hierarchy = response.value
392
+
393
+ mor = MultiObjectResult()
394
+ mor.objects.update(hierarchy.geographical_regions)
395
+ mor.objects.update(hierarchy.sub_geographical_regions)
396
+ mor.objects.update(hierarchy.substations)
397
+ mor.objects.update(hierarchy.feeders)
398
+ mor.objects.update(hierarchy.circuits)
399
+ mor.objects.update(hierarchy.loops)
400
+
401
+ containers: Set[EquipmentContainer] = set()
402
+ for loop in hierarchy.loops.values():
403
+ containers.update(chain(cast(Iterable[EquipmentContainer], loop.circuits), loop.substations, loop.energizing_substations))
404
+
405
+ result = await self._get_equipment_for_containers(map(lambda it: it.mrid, containers), network_state=network_state)
406
+ if result.was_failure:
407
+ # noinspection PyArgumentList
408
+ return GrpcResult(result.thrown, result.was_error_handled)
409
+
410
+ mor.objects.update(result.value.objects)
411
+
412
+ error = await self._resolve_references(mor)
413
+ if error:
414
+ return error
415
+
416
+ # noinspection PyArgumentList
417
+ return GrpcResult(mor)
418
+
419
+ async def _retrieve_network(self) -> GrpcResult[NetworkResult]:
420
+ result = (await self._get_network_hierarchy()).throw_on_error()
421
+
422
+ hierarchy: NetworkHierarchy = result.result
423
+ failed = set()
424
+ for mrid in chain(hierarchy.substations, hierarchy.feeders, hierarchy.circuits):
425
+ result = await self._get_equipment_container(mrid)
426
+ if result.was_successful:
427
+ failed.update(result.result.failed)
428
+
429
+ # noinspection PyArgumentList
430
+ return GrpcResult(NetworkResult(self.service, failed))
431
+
432
+ async def _process_equipment_for_container(
433
+ self, it: Union[str, EquipmentContainer],
434
+ include_energizing_containers: IncludedEnergizingContainers,
435
+ include_energized_containers: IncludedEnergizedContainers,
436
+ network_state: NetworkState = NetworkState.NORMAL
437
+ ) -> AsyncGenerator[IdentifiedObject, None]:
438
+ async for response in self._process_equipment_for_containers(
439
+ [it.mrid if isinstance(it, EquipmentContainer) else it],
440
+ include_energizing_containers,
441
+ include_energized_containers,
442
+ network_state
443
+ ):
444
+ yield response
445
+
446
+ async def _process_equipment_for_containers(
447
+ self,
448
+ mrids: Iterable[str],
449
+ include_energizing_containers: IncludedEnergizingContainers,
450
+ include_energized_containers: IncludedEnergizedContainers,
451
+ network_state: NetworkState = NetworkState.NORMAL
452
+ ) -> AsyncGenerator[IdentifiedObject, None]:
453
+ request = GetEquipmentForContainersRequest()
454
+ request.includeEnergizingContainers = _map_include_energizing_containers.to_pb(include_energizing_containers)
455
+ request.includeEnergizedContainers = _map_include_energized_containers.to_pb(include_energized_containers)
456
+ request.networkState = _map_network_state.to_pb(network_state)
457
+ responses = self._stub.getEquipmentForContainers(self._batch_send(request, mrids), timeout=self.timeout)
458
+ async for response in responses:
459
+ for nio in response.identifiedObjects:
460
+ yield self._extract_identified_object("network", nio, _nio_type_to_cim)
461
+
462
+ async def _process_equipment_for_restriction(self,
463
+ it: Union[str, OperationalRestriction]) -> AsyncGenerator[IdentifiedObject, None]:
464
+ mrid = it.mrid if isinstance(it, OperationalRestriction) else it
465
+ responses = self._stub.getEquipmentForRestriction(GetEquipmentForRestrictionRequest(mrid=mrid), timeout=self.timeout)
466
+ async for response in responses:
467
+ for nio in response.identifiedObjects:
468
+ yield self._extract_identified_object("network", nio, _nio_type_to_cim)
469
+
470
+ async def _process_terminals_for_connectivity_node(self,
471
+ it: Union[str, ConnectivityNode]) -> AsyncGenerator[IdentifiedObject, None]:
472
+ mrid = it.mrid if isinstance(it, ConnectivityNode) else it
473
+ responses = self._stub.getTerminalsForNode(GetTerminalsForNodeRequest(mrid=mrid), timeout=self.timeout)
474
+ async for response in responses:
475
+ # noinspection PyUnresolvedReferences
476
+ yield self.service.get(response.terminal.mrid(), Terminal, default=None) or self.service.add_from_pb(response.terminal), response.terminal.mrid()
477
+
478
+ async def _process_identified_objects(self, mrids: Iterable[str]) -> AsyncGenerator[Tuple[Optional[IdentifiedObject], str], None]:
479
+ if not mrids:
480
+ return
481
+
482
+ responses = self._stub.getIdentifiedObjects(self._batch_send(GetIdentifiedObjectsRequest(), mrids), timeout=self.timeout)
483
+ async for response in responses:
484
+ for nio in response.identifiedObjects:
485
+ yield self._extract_identified_object("network", nio, _nio_type_to_cim)
486
+
487
+ async def _handle_network_hierarchy(self):
488
+ response = await self._stub.getNetworkHierarchy(GetNetworkHierarchyRequest(), timeout=self.timeout)
489
+
490
+ # noinspection PyArgumentList
491
+ self.__network_hierarchy = NetworkHierarchy(
492
+ self._to_map(response.geographicalRegions, GeographicalRegion),
493
+ self._to_map(response.subGeographicalRegions, SubGeographicalRegion),
494
+ self._to_map(response.substations, Substation),
495
+ self._to_map(response.feeders, Feeder),
496
+ self._to_map(response.circuits, Circuit),
497
+ self._to_map(response.loops, Loop)
498
+ )
499
+
500
+ return self.__network_hierarchy
501
+
502
+ async def _handle_multi_object_rpc(self, processor: Callable[[], AsyncGenerator[IdentifiedObject, None]]) -> GrpcResult[MultiObjectResult]:
503
+ result = MultiObjectResult()
504
+
505
+ async def rpc():
506
+ async for io, _mrid in processor():
507
+ if io:
508
+ result.objects[io.mrid] = io
509
+ else:
510
+ result.failed.add(_mrid)
511
+ return result
512
+
513
+ return await self.try_rpc(rpc)
514
+
515
+ async def _get_with_references(self,
516
+ mrid: str,
517
+ expected_class: type(Generic[CIM_IO]),
518
+ get_additional: Callable[[Generic[CIM_IO], MultiObjectResult], Awaitable[Optional[GrpcResult[MultiObjectResult]]]]
519
+ ) -> GrpcResult[MultiObjectResult]:
520
+ if not self.__network_hierarchy:
521
+ response = await self._get_network_hierarchy()
522
+ if response.was_failure:
523
+ # noinspection PyArgumentList
524
+ return GrpcResult(response.thrown, response.was_error_handled)
525
+
526
+ io = self.service.get(mrid, default=None)
527
+ if not io:
528
+ response = await self._get_identified_object(mrid)
529
+ if response.was_failure:
530
+ # noinspection PyArgumentList
531
+ return GrpcResult(response.thrown, response.was_error_handled)
532
+
533
+ io = response.value
534
+
535
+ if not isinstance(io, expected_class):
536
+ e = ValueError(f"Requested mrid {mrid} was not a {expected_class.__name__}, was {type(io).__name__}")
537
+ # noinspection PyArgumentList
538
+ return GrpcResult(e, self.try_handle_error(e))
539
+
540
+ mor = MultiObjectResult()
541
+ mor.objects[io.mrid] = io
542
+
543
+ error = await get_additional(io, mor)
544
+ if error:
545
+ return error
546
+
547
+ error = await self._resolve_references(mor)
548
+ if error:
549
+ return error
550
+
551
+ # noinspection PyArgumentList
552
+ return GrpcResult(mor)
553
+
554
+ async def _resolve_references(self, mor: MultiObjectResult) -> Optional[GrpcResult[MultiObjectResult]]:
555
+ res = mor
556
+ keep_processing = True
557
+ subsequent = False
558
+ while keep_processing:
559
+ to_resolve = set()
560
+ for obj in res.objects:
561
+ for ref in self.service.get_unresolved_references_from(obj):
562
+ # Skip any reference trying to resolve from an EquipmentContainer on subsequent passes - e.g a PowerTransformer trying to pull in its LvFeeder.
563
+ # EquipmentContainers should be retrieved explicitly or via a hierarchy call.
564
+ if subsequent and EquipmentContainer in ref.resolver.from_class.__bases__:
565
+ continue
566
+ # Skip any reference trying to resolve from an asset back to a PSR (e.g. Pole back to ConductingEquipment) on subsequent passes.
567
+ # Subsequent here is not currently necessary, but makes sure that if any future caller of this function starts by resolving
568
+ # from an Asset first, it will pull in the PSR.
569
+ if subsequent and Asset == ref.resolver.from_class and PowerSystemResource == ref.resolver.to_class:
570
+ continue
571
+ to_resolve.add(ref.to_mrid)
572
+
573
+ response = await self._get_identified_objects(to_resolve)
574
+ if response.was_failure:
575
+ # noinspection PyArgumentList
576
+ return GrpcResult(response.thrown, response.was_error_handled)
577
+
578
+ res = response.value
579
+
580
+ mor.objects.update(res.objects)
581
+ mor.failed.update(res.failed)
582
+ keep_processing = bool(res.objects)
583
+ subsequent = True
584
+
585
+ return None
586
+
587
+ def _to_map(self, objects: Iterable[Generic[PB_IO]], class_: type(Generic[CIM_IO])) -> Dict[str, CIM_IO]:
588
+ result = {}
589
+
590
+ for pb in objects:
591
+ # noinspection PyUnresolvedReferences
592
+ cim = self.service.get(pb.mrid(), class_, None) or self.service.add_from_pb(pb)
593
+ result[cim.mrid] = cim
594
+
595
+ return result
596
+
597
+
598
+ class SyncNetworkConsumerClient(NetworkConsumerClient):
599
+ """Synchronised wrapper for :class:`NetworkConsumerClient`"""
600
+
601
+ def get_identified_object(self, mrid: str) -> GrpcResult[IdentifiedObject]:
602
+ return get_event_loop().run_until_complete(super().get_identified_object(mrid))
603
+
604
+ def get_identified_objects(self, mrids: Iterable[str]) -> GrpcResult[MultiObjectResult]:
605
+ return get_event_loop().run_until_complete(super().get_identified_objects(mrids))
606
+
607
+ def get_equipment_for_container(
608
+ self,
609
+ container: Union[str, EquipmentContainer],
610
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
611
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
612
+ network_state: NetworkState = NetworkState.NORMAL
613
+ ) -> GrpcResult[MultiObjectResult]:
614
+ return get_event_loop().run_until_complete(
615
+ super().get_equipment_for_container(container, include_energizing_containers, include_energized_containers, network_state)
616
+ )
617
+
618
+ def get_equipment_for_containers(
619
+ self,
620
+ containers: Iterable[str],
621
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
622
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
623
+ network_state: NetworkState = NetworkState.NORMAL
624
+ ) -> GrpcResult[MultiObjectResult]:
625
+ return get_event_loop().run_until_complete(
626
+ super().get_equipment_for_containers(containers, include_energizing_containers, include_energized_containers, network_state)
627
+ )
628
+
629
+ def get_equipment_for_restriction(self, mrid: str) -> GrpcResult[MultiObjectResult]:
630
+ return get_event_loop().run_until_complete(super().get_equipment_for_restriction(mrid))
631
+
632
+ def get_terminals_for_connectivity_node(self, mrid: str) -> GrpcResult[MultiObjectResult]:
633
+ return get_event_loop().run_until_complete(super().get_terminals_for_connectivity_node(mrid))
634
+
635
+ def get_network_hierarchy(self):
636
+ return get_event_loop().run_until_complete(super().get_network_hierarchy())
637
+
638
+ def get_feeder(self, mrid: str) -> GrpcResult[MultiObjectResult]:
639
+ warnings.warn('`get_feeder` is deprecated, prefer the more generic `get_equipment_container`', DeprecationWarning)
640
+ return get_event_loop().run_until_complete(super().get_equipment_container(mrid, Feeder))
641
+
642
+ def get_equipment_container(
643
+ self,
644
+ mrid: str,
645
+ expected_class: type = EquipmentContainer,
646
+ include_energizing_containers: IncludedEnergizingContainers = IncludedEnergizingContainers.NONE,
647
+ include_energized_containers: IncludedEnergizedContainers = IncludedEnergizedContainers.NONE,
648
+ network_state: NetworkState = NetworkState.NORMAL
649
+ ) -> GrpcResult[MultiObjectResult]:
650
+ return get_event_loop().run_until_complete(
651
+ super().get_equipment_container(mrid, expected_class, include_energizing_containers, include_energized_containers, network_state)
652
+ )
653
+
654
+ def get_equipment_for_loop(self, loop: Union[str, Loop], network_state: NetworkState = NetworkState.NORMAL) -> GrpcResult[MultiObjectResult]:
655
+ # noinspection PyArgumentList
656
+ return get_event_loop().run_until_complete(super().get_equipment_for_loop(self, loop, network_state))
657
+
658
+ def get_all_loops(self, network_state: NetworkState = NetworkState.NORMAL) -> GrpcResult[MultiObjectResult]:
659
+ # noinspection PyArgumentList
660
+ return get_event_loop().run_until_complete(super().get_all_loops(self, network_state))
661
+
662
+ def retrieve_network(self) -> GrpcResult[Union[NetworkResult, Exception]]:
663
+ return get_event_loop().run_until_complete(super().retrieve_network())
664
+
665
+ def get_metadata(self) -> GrpcResult[ServiceInfo]:
666
+ return get_event_loop().run_until_complete(super().get_metadata())
667
+
668
+
669
+ _nio_type_to_cim = {
670
+ ##################################
671
+ # Extensions IEC61968 Asset Info #
672
+ ##################################
673
+
674
+ "relayInfo": RelayInfo,
675
+
676
+ ################################
677
+ # Extensions IEC61968 Metering #
678
+ ################################
679
+
680
+ "panDemandResponseFunction": PanDemandResponseFunction,
681
+
682
+ #################################
683
+ # Extensions IEC61970 Base Core #
684
+ #################################
685
+
686
+ "site": Site,
687
+
688
+ ###################################
689
+ # Extensions IEC61970 Base Feeder #
690
+ ###################################
691
+
692
+ "loop": Loop,
693
+ "lvFeeder": LvFeeder,
694
+
695
+ ##################################################
696
+ # Extensions IEC61970 Base Generation Production #
697
+ ##################################################
698
+
699
+ "evChargingUnit": EvChargingUnit,
700
+
701
+ #######################################
702
+ # Extensions IEC61970 Base Protection #
703
+ #######################################
704
+
705
+ "distanceRelay": DistanceRelay,
706
+ "protectionRelayScheme": ProtectionRelayScheme,
707
+ "protectionRelaySystem": ProtectionRelaySystem,
708
+ "voltageRelay": VoltageRelay,
709
+
710
+ ##################################
711
+ # Extensions IEC61970 Base Wires #
712
+ ##################################
713
+
714
+ "batteryControl": BatteryControl,
715
+
716
+ #######################
717
+ # IEC61968 Asset Info #
718
+ #######################
719
+
720
+ "cableInfo": CableInfo,
721
+ "noLoadTest": NoLoadTest,
722
+ "openCircuitTest": OpenCircuitTest,
723
+ "overheadWireInfo": OverheadWireInfo,
724
+ "powerTransformerInfo": PowerTransformerInfo,
725
+ "shortCircuitTest": ShortCircuitTest,
726
+ "shuntCompensatorInfo": ShuntCompensatorInfo,
727
+ "switchInfo": SwitchInfo,
728
+ "transformerEndInfo": TransformerEndInfo,
729
+ "transformerTankInfo": TransformerTankInfo,
730
+
731
+ ###################
732
+ # IEC61968 Assets #
733
+ ###################
734
+
735
+ "assetOwner": AssetOwner,
736
+
737
+ ###################
738
+ # IEC61968 Common #
739
+ ###################
740
+
741
+ "organisation": Organisation,
742
+ "location": Location,
743
+ "streetlight": Streetlight,
744
+
745
+ #####################################
746
+ # IEC61968 InfIEC61968 InfAssetInfo #
747
+ #####################################
748
+
749
+ "currentTransformerInfo": CurrentTransformerInfo,
750
+ "potentialTransformerInfo": PotentialTransformerInfo,
751
+
752
+ ##################################
753
+ # IEC61968 InfIEC61968 InfAssets #
754
+ ##################################
755
+
756
+ "pole": Pole,
757
+
758
+ #####################
759
+ # IEC61968 Metering #
760
+ #####################
761
+
762
+ "meter": Meter,
763
+ "usagePoint": UsagePoint,
764
+
765
+ #######################
766
+ # IEC61968 Operations #
767
+ #######################
768
+
769
+ "operationalRestriction": OperationalRestriction,
770
+
771
+ #####################################
772
+ # IEC61970 Base Auxiliary Equipment #
773
+ #####################################
774
+
775
+ "currentTransformer": CurrentTransformer,
776
+ "faultIndicator": FaultIndicator,
777
+ "potentialTransformer": PotentialTransformer,
778
+
779
+ ######################
780
+ # IEC61970 Base Core #
781
+ ######################
782
+
783
+ "baseVoltage": BaseVoltage,
784
+ "connectivityNode": ConnectivityNode,
785
+ "feeder": Feeder,
786
+ "geographicalRegion": GeographicalRegion,
787
+ "subGeographicalRegion": SubGeographicalRegion,
788
+ "substation": Substation,
789
+ "terminal": Terminal,
790
+
791
+ #############################
792
+ # IEC61970 Base Equivalents #
793
+ #############################
794
+
795
+ "equivalentBranch": EquivalentBranch,
796
+
797
+ #######################################
798
+ # IEC61970 Base Generation Production #
799
+ #######################################
800
+
801
+ "batteryUnit": BatteryUnit,
802
+ "photoVoltaicUnit": PhotoVoltaicUnit,
803
+ "powerElectronicsWindUnit": PowerElectronicsWindUnit,
804
+
805
+ ######################
806
+ # IEC61970 Base Meas #
807
+ ######################
808
+
809
+ "accumulator": Accumulator,
810
+ "analog": Analog,
811
+ "control": Control,
812
+ "discrete": Discrete,
813
+
814
+ ############################
815
+ # IEC61970 Base Protection #
816
+ ############################
817
+
818
+ "currentRelay": CurrentRelay,
819
+
820
+ #######################
821
+ # IEC61970 Base Scada #
822
+ #######################
823
+
824
+ "remoteControl": RemoteControl,
825
+ "remoteSource": RemoteSource,
826
+
827
+ #######################
828
+ # IEC61970 Base Wires #
829
+ #######################
830
+
831
+ "acLineSegment": AcLineSegment,
832
+ "breaker": Breaker,
833
+ "busbarSection": BusbarSection,
834
+ "clamp": Clamp,
835
+ "cut": Cut,
836
+ "disconnector": Disconnector,
837
+ "energyConsumer": EnergyConsumer,
838
+ "energyConsumerPhase": EnergyConsumerPhase,
839
+ "energySource": EnergySource,
840
+ "energySourcePhase": EnergySourcePhase,
841
+ "fuse": Fuse,
842
+ "ground": Ground,
843
+ "groundDisconnector": GroundDisconnector,
844
+ "groundingImpedance": GroundingImpedance,
845
+ "jumper": Jumper,
846
+ "junction": Junction,
847
+ "linearShuntCompensator": LinearShuntCompensator,
848
+ "loadBreakSwitch": LoadBreakSwitch,
849
+ "perLengthPhaseImpedance": PerLengthPhaseImpedance,
850
+ "perLengthSequenceImpedance": PerLengthSequenceImpedance,
851
+ "petersenCoil": PetersenCoil,
852
+ "powerElectronicsConnection": PowerElectronicsConnection,
853
+ "powerElectronicsConnectionPhase": PowerElectronicsConnectionPhase,
854
+ "powerTransformer": PowerTransformer,
855
+ "powerTransformerEnd": PowerTransformerEnd,
856
+ "ratioTapChanger": RatioTapChanger,
857
+ "reactiveCapabilityCurve": ReactiveCapabilityCurve,
858
+ "recloser": Recloser,
859
+ "seriesCompensator": SeriesCompensator,
860
+ "staticVarCompensator": StaticVarCompensator,
861
+ "synchronousMachine": SynchronousMachine,
862
+ "tapChangerControl": TapChangerControl,
863
+ "transformerStarImpedance": TransformerStarImpedance,
864
+
865
+ ###############################
866
+ # IEC61970 InfIEC61970 Feeder #
867
+ ###############################
868
+
869
+ "circuit": Circuit,
870
+ }