zepben.ewb 1.0.0__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.
- zepben/ewb/__init__.py +601 -0
- zepben/ewb/auth/__init__.py +10 -0
- zepben/ewb/auth/client/__init__.py +5 -0
- zepben/ewb/auth/client/zepben_token_fetcher.py +273 -0
- zepben/ewb/auth/common/__init__.py +5 -0
- zepben/ewb/auth/common/auth_exception.py +16 -0
- zepben/ewb/auth/common/auth_method.py +28 -0
- zepben/ewb/auth/common/auth_provider_config.py +96 -0
- zepben/ewb/database/__init__.py +4 -0
- zepben/ewb/database/paths/__init__.py +4 -0
- zepben/ewb/database/paths/database_type.py +34 -0
- zepben/ewb/database/paths/ewb_data_file_paths.py +237 -0
- zepben/ewb/database/sql/__init__.py +4 -0
- zepben/ewb/database/sql/column.py +37 -0
- zepben/ewb/database/sql/sql_table.py +142 -0
- zepben/ewb/database/sqlite/__init__.py +4 -0
- zepben/ewb/database/sqlite/common/__init__.py +4 -0
- zepben/ewb/database/sqlite/common/base_cim_reader.py +212 -0
- zepben/ewb/database/sqlite/common/base_cim_writer.py +159 -0
- zepben/ewb/database/sqlite/common/base_collection_reader.py +96 -0
- zepben/ewb/database/sqlite/common/base_collection_writer.py +73 -0
- zepben/ewb/database/sqlite/common/base_database_reader.py +127 -0
- zepben/ewb/database/sqlite/common/base_database_tables.py +137 -0
- zepben/ewb/database/sqlite/common/base_database_writer.py +195 -0
- zepben/ewb/database/sqlite/common/base_entry_writer.py +34 -0
- zepben/ewb/database/sqlite/common/base_service_reader.py +50 -0
- zepben/ewb/database/sqlite/common/base_service_writer.py +104 -0
- zepben/ewb/database/sqlite/common/metadata_collection_reader.py +39 -0
- zepben/ewb/database/sqlite/common/metadata_collection_writer.py +38 -0
- zepben/ewb/database/sqlite/common/metadata_entry_reader.py +45 -0
- zepben/ewb/database/sqlite/common/metadata_entry_writer.py +41 -0
- zepben/ewb/database/sqlite/common/reader_exceptions.py +30 -0
- zepben/ewb/database/sqlite/customer/__init__.py +4 -0
- zepben/ewb/database/sqlite/customer/customer_cim_reader.py +169 -0
- zepben/ewb/database/sqlite/customer/customer_cim_writer.py +137 -0
- zepben/ewb/database/sqlite/customer/customer_database_reader.py +44 -0
- zepben/ewb/database/sqlite/customer/customer_database_tables.py +37 -0
- zepben/ewb/database/sqlite/customer/customer_database_writer.py +45 -0
- zepben/ewb/database/sqlite/customer/customer_service_reader.py +57 -0
- zepben/ewb/database/sqlite/customer/customer_service_writer.py +47 -0
- zepben/ewb/database/sqlite/diagram/__init__.py +4 -0
- zepben/ewb/database/sqlite/diagram/diagram_cim_reader.py +105 -0
- zepben/ewb/database/sqlite/diagram/diagram_cim_writer.py +81 -0
- zepben/ewb/database/sqlite/diagram/diagram_database_reader.py +45 -0
- zepben/ewb/database/sqlite/diagram/diagram_database_tables.py +29 -0
- zepben/ewb/database/sqlite/diagram/diagram_database_writer.py +44 -0
- zepben/ewb/database/sqlite/diagram/diagram_service_reader.py +49 -0
- zepben/ewb/database/sqlite/diagram/diagram_service_writer.py +41 -0
- zepben/ewb/database/sqlite/extensions/__init__.py +4 -0
- zepben/ewb/database/sqlite/extensions/prepared_statement.py +112 -0
- zepben/ewb/database/sqlite/extensions/result_set.py +153 -0
- zepben/ewb/database/sqlite/network/__init__.py +4 -0
- zepben/ewb/database/sqlite/network/network_cim_reader.py +3167 -0
- zepben/ewb/database/sqlite/network/network_cim_writer.py +2561 -0
- zepben/ewb/database/sqlite/network/network_database_reader.py +175 -0
- zepben/ewb/database/sqlite/network/network_database_tables.py +242 -0
- zepben/ewb/database/sqlite/network/network_database_writer.py +43 -0
- zepben/ewb/database/sqlite/network/network_service_reader.py +265 -0
- zepben/ewb/database/sqlite/network/network_service_writer.py +209 -0
- zepben/ewb/database/sqlite/tables/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/associations/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/associations/loop_substation_relationship.py +17 -0
- zepben/ewb/database/sqlite/tables/associations/table_asset_organisation_roles_assets.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_assets_power_system_resources.py +41 -0
- zepben/ewb/database/sqlite/tables/associations/table_battery_units_battery_controls.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_circuits_substations.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_circuits_terminals.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_customer_agreements_pricing_structures.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_end_devices_end_device_functions.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_equipment_equipment_containers.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_equipment_operational_restrictions.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_equipment_usage_points.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_loops_substations.py +43 -0
- zepben/ewb/database/sqlite/tables/associations/table_pricing_structures_tariffs.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_protection_relay_functions_protected_switches.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_protection_relay_functions_sensors.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_protection_relay_schemes_protection_relay_functions.py +40 -0
- zepben/ewb/database/sqlite/tables/associations/table_synchronous_machines_reactive_capability_curves.py +39 -0
- zepben/ewb/database/sqlite/tables/associations/table_usage_points_end_devices.py +40 -0
- zepben/ewb/database/sqlite/tables/exceptions.py +10 -0
- zepben/ewb/database/sqlite/tables/extensions/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61968/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61968/assetinfo/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61968/assetinfo/table_reclose_delays.py +38 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61968/assetinfo/table_relay_info.py +21 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61968/metering/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61968/metering/table_pan_demand_response_functions.py +21 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/core/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/core/table_sites.py +15 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/feeder/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/feeder/table_loops.py +15 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/feeder/table_lv_feeders.py +20 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/generation/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/generation/production/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/generation/production/table_ev_charging_units.py +15 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_distance_relays.py +28 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_function_thresholds.py +36 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_function_time_limits.py +34 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_functions.py +24 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_schemes.py +20 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_protection_relay_systems.py +20 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/protection/table_voltage_relays.py +15 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/wires/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/wires/table_battery_controls.py +23 -0
- zepben/ewb/database/sqlite/tables/extensions/iec61970/base/wires/table_power_transformer_end_ratings.py +34 -0
- zepben/ewb/database/sqlite/tables/iec61968/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_cable_info.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_no_load_tests.py +24 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_open_circuit_tests.py +24 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_overhead_wire_info.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_power_transformer_info.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_short_circuit_tests.py +29 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_shunt_compensator_info.py +23 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_switch_info.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_end_info.py +46 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_tank_info.py +27 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_transformer_test.py +19 -0
- zepben/ewb/database/sqlite/tables/iec61968/assetinfo/table_wire_info.py +19 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_containers.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_functions.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_info.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_organisation_roles.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/table_asset_owners.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/table_assets.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/table_streetlights.py +22 -0
- zepben/ewb/database/sqlite/tables/iec61968/assets/table_structures.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_agreements.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_documents.py +23 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_location_street_address_field.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_location_street_addresses.py +33 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_locations.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_organisation_roles.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_organisations.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_position_points.py +30 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_street_addresses.py +26 -0
- zepben/ewb/database/sqlite/tables/iec61968/common/table_town_details.py +19 -0
- zepben/ewb/database/sqlite/tables/iec61968/customers/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/customers/table_customer_agreements.py +27 -0
- zepben/ewb/database/sqlite/tables/iec61968/customers/table_customers.py +22 -0
- zepben/ewb/database/sqlite/tables/iec61968/customers/table_pricing_structures.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/customers/table_tariffs.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/infiec61968/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassetinfo/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassetinfo/table_current_transformer_info.py +33 -0
- zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassetinfo/table_potential_transformer_info.py +26 -0
- zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassets/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/infiec61968/infassets/table_poles.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61968/metering/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/metering/table_end_device_functions.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61968/metering/table_end_devices.py +19 -0
- zepben/ewb/database/sqlite/tables/iec61968/metering/table_meters.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61968/metering/table_usage_points.py +23 -0
- zepben/ewb/database/sqlite/tables/iec61968/operations/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61968/operations/table_operational_restrictions.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_auxiliary_equipment.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_current_transformers.py +21 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_fault_indicators.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_potential_transformers.py +21 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/auxiliaryequipment/table_sensors.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_ac_dc_terminals.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_base_voltages.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_conducting_equipment.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_connectivity_node_containers.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_connectivity_nodes.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_curve_data.py +46 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_curves.py +17 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_equipment.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_equipment_containers.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_feeders.py +28 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_geographical_regions.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_identified_objects.py +29 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_name_types.py +28 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_names.py +36 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_power_system_resources.py +19 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_sub_geographical_regions.py +27 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_substations.py +27 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/core/table_terminals.py +35 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagram_object_points.py +35 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagram_objects.py +31 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/diagramlayout/table_diagrams.py +21 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/equivalents/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/equivalents/table_equivalent_branches.py +35 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/equivalents/table_equivalent_equipment.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/generation/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_battery_units.py +22 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_photo_voltaic_units.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_power_electronics_units.py +26 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/generation/production/table_power_electronics_wind_units.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/meas/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_accumulators.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_analogs.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_controls.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_discretes.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_io_points.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/meas/table_measurements.py +30 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/protection/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/protection/table_current_relays.py +22 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/scada/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/scada/table_remote_controls.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/scada/table_remote_points.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/scada/table_remote_sources.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_ac_line_segments.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_breakers.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_busbar_sections.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_clamps.py +23 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_conductors.py +21 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_connectors.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_cuts.py +23 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_disconnectors.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_earth_fault_compensators.py +22 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_connections.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_consumer_phases.py +37 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_consumers.py +26 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_source_phases.py +33 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_energy_sources.py +44 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_fuses.py +20 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_ground_disconnectors.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_grounding_impedances.py +24 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_grounds.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_jumpers.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_junctions.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_linear_shunt_compensators.py +23 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_lines.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_load_break_switches.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_impedances.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_line_parameters.py +14 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_phase_impedances.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_per_length_sequence_impedances.py +27 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_petersen_coils.py +27 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_phase_impedance_data.py +52 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_electronics_connection_phases.py +30 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_electronics_connections.py +50 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_transformer_ends.py +43 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_power_transformers.py +24 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_protected_switches.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_ratio_tap_changers.py +28 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_reactive_capability_curves.py +18 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_reclosers.py +15 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_regulating_cond_eq.py +19 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_regulating_controls.py +29 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_rotating_machines.py +36 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_series_compensators.py +25 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_shunt_compensators.py +22 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_static_var_compensator.py +24 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_switches.py +21 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_synchronous_machines.py +95 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_tap_changer_controls.py +28 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_tap_changers.py +25 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_transformer_ends.py +30 -0
- zepben/ewb/database/sqlite/tables/iec61970/base/wires/table_transformer_star_impedances.py +32 -0
- zepben/ewb/database/sqlite/tables/iec61970/infiec61970/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/infiec61970/feeder/__init__.py +4 -0
- zepben/ewb/database/sqlite/tables/iec61970/infiec61970/feeder/table_circuits.py +27 -0
- zepben/ewb/database/sqlite/tables/sqlite_table.py +45 -0
- zepben/ewb/database/sqlite/tables/table_metadata_data_sources.py +21 -0
- zepben/ewb/database/sqlite/tables/table_version.py +39 -0
- zepben/ewb/dataclassy/__init__.py +15 -0
- zepben/ewb/dataclassy/dataclass.py +192 -0
- zepben/ewb/dataclassy/decorator.py +35 -0
- zepben/ewb/dataclassy/functions.py +80 -0
- zepben/ewb/examples/__init__.py +6 -0
- zepben/ewb/examples/simple_test_network.py +158 -0
- zepben/ewb/exceptions.py +52 -0
- zepben/ewb/model/__init__.py +4 -0
- zepben/ewb/model/busbranch/__init__.py +4 -0
- zepben/ewb/model/busbranch/bus_branch.py +1051 -0
- zepben/ewb/model/cim/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61968/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61968/assetinfo/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61968/assetinfo/relay_info.py +128 -0
- zepben/ewb/model/cim/extensions/iec61968/metering/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61968/metering/pan_demand_reponse_function.py +112 -0
- zepben/ewb/model/cim/extensions/iec61970/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61970/base/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61970/base/core/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61970/base/core/site.py +37 -0
- zepben/ewb/model/cim/extensions/iec61970/base/feeder/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61970/base/feeder/loop.py +207 -0
- zepben/ewb/model/cim/extensions/iec61970/base/feeder/lv_feeder.py +258 -0
- zepben/ewb/model/cim/extensions/iec61970/base/generation/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61970/base/generation/production/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61970/base/generation/production/ev_charging_unit.py +18 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/distance_relay.py +69 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/power_direction_kind.py +36 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_kind.py +112 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_relay_function.py +448 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_relay_scheme.py +97 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_relay_system.py +97 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/relay_setting.py +35 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/voltage_relay.py +20 -0
- zepben/ewb/model/cim/extensions/iec61970/base/wires/__init__.py +4 -0
- zepben/ewb/model/cim/extensions/iec61970/base/wires/battery_control.py +36 -0
- zepben/ewb/model/cim/extensions/iec61970/base/wires/battery_control_mode.py +83 -0
- zepben/ewb/model/cim/extensions/iec61970/base/wires/transformer_cooling_type.py +57 -0
- zepben/ewb/model/cim/extensions/iec61970/base/wires/transformer_end_rated_s.py +26 -0
- zepben/ewb/model/cim/extensions/iec61970/base/wires/vector_group.py +293 -0
- zepben/ewb/model/cim/extensions/zbex.py +17 -0
- zepben/ewb/model/cim/iec61968/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/assetinfo/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/assetinfo/cable_info.py +15 -0
- zepben/ewb/model/cim/iec61968/assetinfo/no_load_test.py +42 -0
- zepben/ewb/model/cim/iec61968/assetinfo/open_circuit_test.py +42 -0
- zepben/ewb/model/cim/iec61968/assetinfo/overhead_wire_info.py +15 -0
- zepben/ewb/model/cim/iec61968/assetinfo/power_transformer_info.py +103 -0
- zepben/ewb/model/cim/iec61968/assetinfo/short_circuit_test.py +67 -0
- zepben/ewb/model/cim/iec61968/assetinfo/shunt_compensator_info.py +26 -0
- zepben/ewb/model/cim/iec61968/assetinfo/switch_info.py +17 -0
- zepben/ewb/model/cim/iec61968/assetinfo/transformer_end_info.py +137 -0
- zepben/ewb/model/cim/iec61968/assetinfo/transformer_tank_info.py +108 -0
- zepben/ewb/model/cim/iec61968/assetinfo/transformer_test.py +26 -0
- zepben/ewb/model/cim/iec61968/assetinfo/wire_info.py +24 -0
- zepben/ewb/model/cim/iec61968/assetinfo/wire_material_kind.py +57 -0
- zepben/ewb/model/cim/iec61968/assets/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/assets/asset.py +154 -0
- zepben/ewb/model/cim/iec61968/assets/asset_container.py +16 -0
- zepben/ewb/model/cim/iec61968/assets/asset_function.py +15 -0
- zepben/ewb/model/cim/iec61968/assets/asset_info.py +19 -0
- zepben/ewb/model/cim/iec61968/assets/asset_organisation_role.py +13 -0
- zepben/ewb/model/cim/iec61968/assets/asset_owner.py +13 -0
- zepben/ewb/model/cim/iec61968/assets/streetlight.py +29 -0
- zepben/ewb/model/cim/iec61968/assets/structure.py +16 -0
- zepben/ewb/model/cim/iec61968/common/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/common/agreement.py +16 -0
- zepben/ewb/model/cim/iec61968/common/document.py +36 -0
- zepben/ewb/model/cim/iec61968/common/location.py +129 -0
- zepben/ewb/model/cim/iec61968/common/organisation.py +15 -0
- zepben/ewb/model/cim/iec61968/common/organisation_role.py +22 -0
- zepben/ewb/model/cim/iec61968/common/position_point.py +44 -0
- zepben/ewb/model/cim/iec61968/common/street_address.py +28 -0
- zepben/ewb/model/cim/iec61968/common/street_detail.py +46 -0
- zepben/ewb/model/cim/iec61968/common/town_detail.py +25 -0
- zepben/ewb/model/cim/iec61968/customers/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/customers/customer.py +93 -0
- zepben/ewb/model/cim/iec61968/customers/customer_agreement.py +107 -0
- zepben/ewb/model/cim/iec61968/customers/customer_kind.py +69 -0
- zepben/ewb/model/cim/iec61968/customers/pricing_structure.py +88 -0
- zepben/ewb/model/cim/iec61968/customers/tariff.py +18 -0
- zepben/ewb/model/cim/iec61968/infiec61968/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/current_transformer_info.py +51 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/potential_transformer_info.py +33 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/transformer_construction_kind.py +69 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/transformer_function_kind.py +45 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassets/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassets/pole.py +87 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassets/streetlight_lamp_kind.py +27 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infcommon/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infcommon/ratio.py +34 -0
- zepben/ewb/model/cim/iec61968/metering/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/metering/controlled_appliance.py +152 -0
- zepben/ewb/model/cim/iec61968/metering/end_device.py +165 -0
- zepben/ewb/model/cim/iec61968/metering/end_device_function.py +17 -0
- zepben/ewb/model/cim/iec61968/metering/end_device_function_kind.py +48 -0
- zepben/ewb/model/cim/iec61968/metering/meter.py +28 -0
- zepben/ewb/model/cim/iec61968/metering/usage_point.py +186 -0
- zepben/ewb/model/cim/iec61968/operations/__init__.py +4 -0
- zepben/ewb/model/cim/iec61968/operations/operational_restriction.py +92 -0
- zepben/ewb/model/cim/iec61970/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/auxiliary_equipment.py +24 -0
- zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/current_transformer.py +37 -0
- zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/fault_indicator.py +18 -0
- zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/potential_transformer.py +38 -0
- zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/potential_transformer_kind.py +30 -0
- zepben/ewb/model/cim/iec61970/base/auxiliaryequipment/sensor.py +92 -0
- zepben/ewb/model/cim/iec61970/base/core/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/core/ac_dc_terminal.py +16 -0
- zepben/ewb/model/cim/iec61970/base/core/base_voltage.py +17 -0
- zepben/ewb/model/cim/iec61970/base/core/conducting_equipment.py +198 -0
- zepben/ewb/model/cim/iec61970/base/core/connectivity_node.py +105 -0
- zepben/ewb/model/cim/iec61970/base/core/connectivity_node_container.py +15 -0
- zepben/ewb/model/cim/iec61970/base/core/curve.py +125 -0
- zepben/ewb/model/cim/iec61970/base/core/curve_data.py +29 -0
- zepben/ewb/model/cim/iec61970/base/core/equipment.py +366 -0
- zepben/ewb/model/cim/iec61970/base/core/equipment_container.py +199 -0
- zepben/ewb/model/cim/iec61970/base/core/feeder.py +260 -0
- zepben/ewb/model/cim/iec61970/base/core/geographical_region.py +82 -0
- zepben/ewb/model/cim/iec61970/base/core/identified_object.py +239 -0
- zepben/ewb/model/cim/iec61970/base/core/name.py +36 -0
- zepben/ewb/model/cim/iec61970/base/core/name_type.py +203 -0
- zepben/ewb/model/cim/iec61970/base/core/phase_code.py +202 -0
- zepben/ewb/model/cim/iec61970/base/core/power_system_resource.py +106 -0
- zepben/ewb/model/cim/iec61970/base/core/sub_geographical_region.py +93 -0
- zepben/ewb/model/cim/iec61970/base/core/substation.py +277 -0
- zepben/ewb/model/cim/iec61970/base/core/terminal.py +171 -0
- zepben/ewb/model/cim/iec61970/base/diagramlayout/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram.py +109 -0
- zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_object.py +160 -0
- zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_object_point.py +25 -0
- zepben/ewb/model/cim/iec61970/base/diagramlayout/diagram_style.py +28 -0
- zepben/ewb/model/cim/iec61970/base/diagramlayout/orientation_kind.py +29 -0
- zepben/ewb/model/cim/iec61970/base/domain/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/domain/unit_symbol.py +494 -0
- zepben/ewb/model/cim/iec61970/base/equivalents/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/equivalents/equivalent_branch.py +113 -0
- zepben/ewb/model/cim/iec61970/base/equivalents/equivalent_equipment.py +15 -0
- zepben/ewb/model/cim/iec61970/base/generation/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/generation/production/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/generation/production/battery_state_kind.py +39 -0
- zepben/ewb/model/cim/iec61970/base/generation/production/battery_unit.py +108 -0
- zepben/ewb/model/cim/iec61970/base/generation/production/photo_voltaic_unit.py +13 -0
- zepben/ewb/model/cim/iec61970/base/generation/production/power_electronics_unit.py +28 -0
- zepben/ewb/model/cim/iec61970/base/generation/production/power_electronics_wind_unit.py +13 -0
- zepben/ewb/model/cim/iec61970/base/meas/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/meas/accumulator.py +13 -0
- zepben/ewb/model/cim/iec61970/base/meas/accumulator_value.py +20 -0
- zepben/ewb/model/cim/iec61970/base/meas/analog.py +18 -0
- zepben/ewb/model/cim/iec61970/base/meas/analog_value.py +20 -0
- zepben/ewb/model/cim/iec61970/base/meas/control.py +26 -0
- zepben/ewb/model/cim/iec61970/base/meas/discrete.py +13 -0
- zepben/ewb/model/cim/iec61970/base/meas/discrete_value.py +20 -0
- zepben/ewb/model/cim/iec61970/base/meas/iopoint.py +16 -0
- zepben/ewb/model/cim/iec61970/base/meas/measurement.py +60 -0
- zepben/ewb/model/cim/iec61970/base/meas/measurement_value.py +21 -0
- zepben/ewb/model/cim/iec61970/base/protection/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/protection/current_relay.py +23 -0
- zepben/ewb/model/cim/iec61970/base/scada/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/scada/remote_control.py +22 -0
- zepben/ewb/model/cim/iec61970/base/scada/remote_point.py +16 -0
- zepben/ewb/model/cim/iec61970/base/scada/remote_source.py +22 -0
- zepben/ewb/model/cim/iec61970/base/wires/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/wires/ac_line_segment.py +214 -0
- zepben/ewb/model/cim/iec61970/base/wires/breaker.py +32 -0
- zepben/ewb/model/cim/iec61970/base/wires/busbar_section.py +19 -0
- zepben/ewb/model/cim/iec61970/base/wires/clamp.py +32 -0
- zepben/ewb/model/cim/iec61970/base/wires/conductor.py +49 -0
- zepben/ewb/model/cim/iec61970/base/wires/connector.py +16 -0
- zepben/ewb/model/cim/iec61970/base/wires/cut.py +36 -0
- zepben/ewb/model/cim/iec61970/base/wires/disconnector.py +17 -0
- zepben/ewb/model/cim/iec61970/base/wires/earth_fault_compensator.py +21 -0
- zepben/ewb/model/cim/iec61970/base/wires/energy_connection.py +15 -0
- zepben/ewb/model/cim/iec61970/base/wires/energy_consumer.py +107 -0
- zepben/ewb/model/cim/iec61970/base/wires/energy_consumer_phase.py +56 -0
- zepben/ewb/model/cim/iec61970/base/wires/energy_source.py +172 -0
- zepben/ewb/model/cim/iec61970/base/wires/energy_source_phase.py +45 -0
- zepben/ewb/model/cim/iec61970/base/wires/fuse.py +23 -0
- zepben/ewb/model/cim/iec61970/base/wires/ground.py +15 -0
- zepben/ewb/model/cim/iec61970/base/wires/ground_disconnector.py +15 -0
- zepben/ewb/model/cim/iec61970/base/wires/grounding_impedance.py +19 -0
- zepben/ewb/model/cim/iec61970/base/wires/jumper.py +16 -0
- zepben/ewb/model/cim/iec61970/base/wires/junction.py +15 -0
- zepben/ewb/model/cim/iec61970/base/wires/line.py +13 -0
- zepben/ewb/model/cim/iec61970/base/wires/linear_shunt_compensator.py +26 -0
- zepben/ewb/model/cim/iec61970/base/wires/load_break_switch.py +14 -0
- zepben/ewb/model/cim/iec61970/base/wires/per_length_impedance.py +13 -0
- zepben/ewb/model/cim/iec61970/base/wires/per_length_line_parameter.py +13 -0
- zepben/ewb/model/cim/iec61970/base/wires/per_length_phase_impedance.py +99 -0
- zepben/ewb/model/cim/iec61970/base/wires/per_length_sequence_impedance.py +43 -0
- zepben/ewb/model/cim/iec61970/base/wires/petersen_coil.py +22 -0
- zepben/ewb/model/cim/iec61970/base/wires/phase_impedance_data.py +37 -0
- zepben/ewb/model/cim/iec61970/base/wires/phase_shunt_connection_kind.py +40 -0
- zepben/ewb/model/cim/iec61970/base/wires/power_electronics_connection.py +524 -0
- zepben/ewb/model/cim/iec61970/base/wires/power_electronics_connection_phase.py +34 -0
- zepben/ewb/model/cim/iec61970/base/wires/power_transformer.py +217 -0
- zepben/ewb/model/cim/iec61970/base/wires/power_transformer_end.py +208 -0
- zepben/ewb/model/cim/iec61970/base/wires/protected_switch.py +96 -0
- zepben/ewb/model/cim/iec61970/base/wires/ratio_tap_changer.py +30 -0
- zepben/ewb/model/cim/iec61970/base/wires/reactive_capability_curve.py +16 -0
- zepben/ewb/model/cim/iec61970/base/wires/recloser.py +15 -0
- zepben/ewb/model/cim/iec61970/base/wires/regulating_cond_eq.py +45 -0
- zepben/ewb/model/cim/iec61970/base/wires/regulating_control.py +173 -0
- zepben/ewb/model/cim/iec61970/base/wires/regulating_control_mode_kind.py +48 -0
- zepben/ewb/model/cim/iec61970/base/wires/rotating_machine.py +36 -0
- zepben/ewb/model/cim/iec61970/base/wires/series_compensator.py +42 -0
- zepben/ewb/model/cim/iec61970/base/wires/shunt_compensator.py +59 -0
- zepben/ewb/model/cim/iec61970/base/wires/single_phase_kind.py +107 -0
- zepben/ewb/model/cim/iec61970/base/wires/static_var_compensator.py +40 -0
- zepben/ewb/model/cim/iec61970/base/wires/svc_control_mode.py +30 -0
- zepben/ewb/model/cim/iec61970/base/wires/switch.py +119 -0
- zepben/ewb/model/cim/iec61970/base/wires/synchronous_machine.py +168 -0
- zepben/ewb/model/cim/iec61970/base/wires/synchronous_machine_kind.py +46 -0
- zepben/ewb/model/cim/iec61970/base/wires/tap_changer.py +150 -0
- zepben/ewb/model/cim/iec61970/base/wires/tap_changer_control.py +49 -0
- zepben/ewb/model/cim/iec61970/base/wires/transformer_end.py +73 -0
- zepben/ewb/model/cim/iec61970/base/wires/transformer_star_impedance.py +48 -0
- zepben/ewb/model/cim/iec61970/base/wires/winding_connection.py +45 -0
- zepben/ewb/model/cim/iec61970/infiec61970/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/infiec61970/feeder/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/infiec61970/feeder/circuit.py +144 -0
- zepben/ewb/model/phases.py +168 -0
- zepben/ewb/model/resistance_reactance.py +40 -0
- zepben/ewb/services/__init__.py +4 -0
- zepben/ewb/services/common/__init__.py +16 -0
- zepben/ewb/services/common/base_service.py +383 -0
- zepben/ewb/services/common/base_service_comparator.py +394 -0
- zepben/ewb/services/common/difference.py +47 -0
- zepben/ewb/services/common/enum_mapper.py +55 -0
- zepben/ewb/services/common/meta/__init__.py +4 -0
- zepben/ewb/services/common/meta/data_source.py +16 -0
- zepben/ewb/services/common/meta/metadata_collection.py +28 -0
- zepben/ewb/services/common/meta/metadata_translations.py +47 -0
- zepben/ewb/services/common/meta/service_info.py +22 -0
- zepben/ewb/services/common/reference_resolvers.py +374 -0
- zepben/ewb/services/common/resolver.py +597 -0
- zepben/ewb/services/common/translator/__init__.py +4 -0
- zepben/ewb/services/common/translator/base_cim2proto.py +115 -0
- zepben/ewb/services/common/translator/base_proto2cim.py +146 -0
- zepben/ewb/services/common/translator/service_differences.py +81 -0
- zepben/ewb/services/common/translator/util.py +75 -0
- zepben/ewb/services/customer/__init__.py +4 -0
- zepben/ewb/services/customer/customer_service_comparator.py +52 -0
- zepben/ewb/services/customer/customers.py +23 -0
- zepben/ewb/services/customer/translator/__init__.py +21 -0
- zepben/ewb/services/customer/translator/customer_cim2proto.py +71 -0
- zepben/ewb/services/customer/translator/customer_enum_mappers.py +18 -0
- zepben/ewb/services/customer/translator/customer_proto2cim.py +87 -0
- zepben/ewb/services/diagram/__init__.py +4 -0
- zepben/ewb/services/diagram/diagram_service_comparator.py +39 -0
- zepben/ewb/services/diagram/diagrams.py +107 -0
- zepben/ewb/services/diagram/translator/__init__.py +11 -0
- zepben/ewb/services/diagram/translator/diagram_cim2proto.py +51 -0
- zepben/ewb/services/diagram/translator/diagram_enum_mappers.py +21 -0
- zepben/ewb/services/diagram/translator/diagram_proto2cim.py +61 -0
- zepben/ewb/services/measurement/__init__.py +4 -0
- zepben/ewb/services/measurement/measurements.py +35 -0
- zepben/ewb/services/measurement/translator/__init__.py +6 -0
- zepben/ewb/services/measurement/translator/measurement_cim2proto.py +42 -0
- zepben/ewb/services/measurement/translator/measurement_proto2cim.py +52 -0
- zepben/ewb/services/network/__init__.py +4 -0
- zepben/ewb/services/network/network_extensions.py +119 -0
- zepben/ewb/services/network/network_service.py +302 -0
- zepben/ewb/services/network/network_service_comparator.py +1322 -0
- zepben/ewb/services/network/network_state.py +36 -0
- zepben/ewb/services/network/tracing/__init__.py +4 -0
- zepben/ewb/services/network/tracing/busbranch_trace.py +36 -0
- zepben/ewb/services/network/tracing/connectivity/__init__.py +4 -0
- zepben/ewb/services/network/tracing/connectivity/connectivity_result.py +105 -0
- zepben/ewb/services/network/tracing/connectivity/nominal_phase_path.py +23 -0
- zepben/ewb/services/network/tracing/connectivity/phase_paths.py +70 -0
- zepben/ewb/services/network/tracing/connectivity/terminal_connectivity_connected.py +226 -0
- zepben/ewb/services/network/tracing/connectivity/terminal_connectivity_internal.py +64 -0
- zepben/ewb/services/network/tracing/connectivity/transformer_phase_paths.py +202 -0
- zepben/ewb/services/network/tracing/connectivity/xy_candidate_phase_paths.py +235 -0
- zepben/ewb/services/network/tracing/connectivity/xy_phase_step.py +24 -0
- zepben/ewb/services/network/tracing/feeder/__init__.py +4 -0
- zepben/ewb/services/network/tracing/feeder/assign_to_feeders.py +202 -0
- zepben/ewb/services/network/tracing/feeder/assign_to_lv_feeders.py +202 -0
- zepben/ewb/services/network/tracing/feeder/clear_direction.py +80 -0
- zepben/ewb/services/network/tracing/feeder/direction_status.py +133 -0
- zepben/ewb/services/network/tracing/feeder/feeder_direction.py +107 -0
- zepben/ewb/services/network/tracing/feeder/set_direction.py +143 -0
- zepben/ewb/services/network/tracing/find_swer_equipment.py +175 -0
- zepben/ewb/services/network/tracing/networktrace/__init__.py +4 -0
- zepben/ewb/services/network/tracing/networktrace/actions/__init__.py +4 -0
- zepben/ewb/services/network/tracing/networktrace/actions/equipment_tree_builder.py +104 -0
- zepben/ewb/services/network/tracing/networktrace/actions/tree_node.py +35 -0
- zepben/ewb/services/network/tracing/networktrace/compute_data.py +60 -0
- zepben/ewb/services/network/tracing/networktrace/conditions/__init__.py +4 -0
- zepben/ewb/services/network/tracing/networktrace/conditions/conditions.py +73 -0
- zepben/ewb/services/network/tracing/networktrace/conditions/direction_condition.py +63 -0
- zepben/ewb/services/network/tracing/networktrace/conditions/equipment_step_limit_condition.py +26 -0
- zepben/ewb/services/network/tracing/networktrace/conditions/equipment_type_step_limit_condition.py +44 -0
- zepben/ewb/services/network/tracing/networktrace/conditions/network_trace_queue_condition.py +67 -0
- zepben/ewb/services/network/tracing/networktrace/conditions/network_trace_stop_condition.py +65 -0
- zepben/ewb/services/network/tracing/networktrace/conditions/open_condition.py +39 -0
- zepben/ewb/services/network/tracing/networktrace/network_trace.py +433 -0
- zepben/ewb/services/network/tracing/networktrace/network_trace_action_type.py +42 -0
- zepben/ewb/services/network/tracing/networktrace/network_trace_queue_next.py +84 -0
- zepben/ewb/services/network/tracing/networktrace/network_trace_step.py +128 -0
- zepben/ewb/services/network/tracing/networktrace/network_trace_step_path_provider.py +351 -0
- zepben/ewb/services/network/tracing/networktrace/network_trace_tracker.py +39 -0
- zepben/ewb/services/network/tracing/networktrace/operators/__init__.py +14 -0
- zepben/ewb/services/network/tracing/networktrace/operators/equipment_container_state_operators.py +264 -0
- zepben/ewb/services/network/tracing/networktrace/operators/feeder_direction_state_operations.py +181 -0
- zepben/ewb/services/network/tracing/networktrace/operators/in_service_state_operators.py +76 -0
- zepben/ewb/services/network/tracing/networktrace/operators/network_state_operators.py +120 -0
- zepben/ewb/services/network/tracing/networktrace/operators/open_state_operators.py +104 -0
- zepben/ewb/services/network/tracing/networktrace/operators/phase_state_operators.py +56 -0
- zepben/ewb/services/network/tracing/networktrace/tracing.py +132 -0
- zepben/ewb/services/network/tracing/phases/__init__.py +4 -0
- zepben/ewb/services/network/tracing/phases/phase_inferrer.py +205 -0
- zepben/ewb/services/network/tracing/phases/phase_status.py +101 -0
- zepben/ewb/services/network/tracing/phases/remove_phases.py +143 -0
- zepben/ewb/services/network/tracing/phases/set_phases.py +490 -0
- zepben/ewb/services/network/tracing/traversal/__init__.py +4 -0
- zepben/ewb/services/network/tracing/traversal/context_value_computer.py +63 -0
- zepben/ewb/services/network/tracing/traversal/debug_logging.py +124 -0
- zepben/ewb/services/network/tracing/traversal/queue.py +112 -0
- zepben/ewb/services/network/tracing/traversal/queue_condition.py +75 -0
- zepben/ewb/services/network/tracing/traversal/step_action.py +83 -0
- zepben/ewb/services/network/tracing/traversal/step_context.py +59 -0
- zepben/ewb/services/network/tracing/traversal/stop_condition.py +57 -0
- zepben/ewb/services/network/tracing/traversal/traversal.py +634 -0
- zepben/ewb/services/network/tracing/traversal/traversal_condition.py +22 -0
- zepben/ewb/services/network/tracing/traversal/weighted_priority_queue.py +85 -0
- zepben/ewb/services/network/tracing/util.py +93 -0
- zepben/ewb/services/network/translator/__init__.py +392 -0
- zepben/ewb/services/network/translator/network_cim2proto.py +1867 -0
- zepben/ewb/services/network/translator/network_enum_mappers.py +78 -0
- zepben/ewb/services/network/translator/network_proto2cim.py +2201 -0
- zepben/ewb/services/services.py +48 -0
- zepben/ewb/streaming/__init__.py +4 -0
- zepben/ewb/streaming/data/__init__.py +4 -0
- zepben/ewb/streaming/data/current_state_event.py +314 -0
- zepben/ewb/streaming/data/current_state_event_batch.py +25 -0
- zepben/ewb/streaming/data/set_current_states_status.py +286 -0
- zepben/ewb/streaming/exceptions.py +14 -0
- zepben/ewb/streaming/get/__init__.py +4 -0
- zepben/ewb/streaming/get/consumer.py +209 -0
- zepben/ewb/streaming/get/customer_consumer.py +111 -0
- zepben/ewb/streaming/get/diagram_consumer.py +107 -0
- zepben/ewb/streaming/get/hierarchy/__init__.py +4 -0
- zepben/ewb/streaming/get/hierarchy/data.py +27 -0
- zepben/ewb/streaming/get/included_energized_containers.py +36 -0
- zepben/ewb/streaming/get/included_energizing_containers.py +36 -0
- zepben/ewb/streaming/get/network_consumer.py +870 -0
- zepben/ewb/streaming/get/query_network_state_client.py +64 -0
- zepben/ewb/streaming/get/query_network_state_service.py +94 -0
- zepben/ewb/streaming/grpc/__init__.py +4 -0
- zepben/ewb/streaming/grpc/auth_token_plugin.py +24 -0
- zepben/ewb/streaming/grpc/connect.py +209 -0
- zepben/ewb/streaming/grpc/grpc.py +107 -0
- zepben/ewb/streaming/grpc/grpc_channel_builder.py +190 -0
- zepben/ewb/streaming/mutations/__init__.py +4 -0
- zepben/ewb/streaming/mutations/update_network_state_client.py +80 -0
- zepben/ewb/streaming/mutations/update_network_state_service.py +61 -0
- zepben/ewb/testing/__init__.py +4 -0
- zepben/ewb/testing/test_network_builder.py +816 -0
- zepben/ewb/types.py +17 -0
- zepben/ewb/util.py +200 -0
- zepben_ewb-1.0.0.dist-info/METADATA +90 -0
- zepben_ewb-1.0.0.dist-info/RECORD +641 -0
- zepben_ewb-1.0.0.dist-info/WHEEL +5 -0
- zepben_ewb-1.0.0.dist-info/licenses/LICENSE +374 -0
- zepben_ewb-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,239 @@
|
|
|
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__ = ["IdentifiedObject", "TIdentifiedObject"]
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
from abc import ABCMeta
|
|
12
|
+
from typing import Callable, Any, List, Generator, Optional, overload, TypeVar
|
|
13
|
+
|
|
14
|
+
from zepben.ewb.dataclassy import dataclass
|
|
15
|
+
from zepben.ewb.model.cim.iec61970.base.core.name import Name
|
|
16
|
+
from zepben.ewb.model.cim.iec61970.base.core.name_type import NameType
|
|
17
|
+
from zepben.ewb.util import require, CopyableUUID, nlen, ngen, safe_remove
|
|
18
|
+
|
|
19
|
+
logger = logging.getLogger(__name__)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(slots=True)
|
|
23
|
+
class IdentifiedObject(object, metaclass=ABCMeta):
|
|
24
|
+
"""
|
|
25
|
+
Root class to provide common identification for all classes needing identification and naming attributes.
|
|
26
|
+
Everything should extend this class, however it's not mandated that every subclass must use all the fields
|
|
27
|
+
defined here.
|
|
28
|
+
|
|
29
|
+
All names of attributes of classes extending this class *must* directly reflect CIM properties if they have a direct
|
|
30
|
+
relation, however must be in snake case to keep the phases PEP compliant.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
mrid: str = CopyableUUID()
|
|
34
|
+
"""Master resource identifier issued by a model authority. The mRID is unique within an exchange context.
|
|
35
|
+
Global uniqueness is easily achieved by using a UUID, as specified in RFC 4122, for the mRID. The use of UUID is strongly recommended."""
|
|
36
|
+
|
|
37
|
+
name: Optional[str] = None
|
|
38
|
+
"""The name is any free human readable and possibly non unique text naming the object."""
|
|
39
|
+
|
|
40
|
+
description: Optional[str] = None
|
|
41
|
+
"""a free human readable text describing or naming the object. It may be non unique and may not correlate to a naming hierarchy."""
|
|
42
|
+
|
|
43
|
+
_names: Optional[List[Name]] = None
|
|
44
|
+
|
|
45
|
+
# TODO: Missing num_diagram_objects: int = None def has_diagram_objects(self): return (self.num_diagram_objects or 0) > 0
|
|
46
|
+
|
|
47
|
+
def __init__(self, names: Optional[List[Name]] = None, **kwargs):
|
|
48
|
+
super(IdentifiedObject, self).__init__(**kwargs)
|
|
49
|
+
if names:
|
|
50
|
+
for name in names:
|
|
51
|
+
self.add_name(name.type, name.name)
|
|
52
|
+
|
|
53
|
+
def __str__(self):
|
|
54
|
+
class_name = f'{self.__class__.__name__}'
|
|
55
|
+
if self.name:
|
|
56
|
+
return f'{class_name}{{{self.mrid}|{self.name}}}'
|
|
57
|
+
return f'{class_name}{{{self.mrid}}}'
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def names(self) -> Generator[Name, None, None]:
|
|
61
|
+
"""All names of this identified object. The returned collection is read only."""
|
|
62
|
+
return ngen(self._names)
|
|
63
|
+
|
|
64
|
+
def num_names(self) -> int:
|
|
65
|
+
"""Get the number of entries in the `Name` collection."""
|
|
66
|
+
return nlen(self._names)
|
|
67
|
+
|
|
68
|
+
@overload
|
|
69
|
+
def has_name(self, name_type: NameType, name: str) -> bool:
|
|
70
|
+
...
|
|
71
|
+
|
|
72
|
+
@overload
|
|
73
|
+
def has_name(self, name_type: str, name: str) -> bool:
|
|
74
|
+
...
|
|
75
|
+
|
|
76
|
+
def has_name(self, name_type, name) -> bool:
|
|
77
|
+
"""
|
|
78
|
+
Check to see if this object has a `Name` with the matching `name_type` and `name`
|
|
79
|
+
|
|
80
|
+
:return: True if a matching `Name` was found, otherwise False.
|
|
81
|
+
"""
|
|
82
|
+
if self._names:
|
|
83
|
+
for name_ in self._names:
|
|
84
|
+
if isinstance(name_type, str):
|
|
85
|
+
if name_.type.name == name_type and name_.name == name:
|
|
86
|
+
return True
|
|
87
|
+
elif isinstance(name_type, NameType):
|
|
88
|
+
if name_.type == name_type and name_.name == name:
|
|
89
|
+
return True
|
|
90
|
+
return False
|
|
91
|
+
|
|
92
|
+
@overload
|
|
93
|
+
def get_name(self, name_type: NameType, name: str) -> Name:
|
|
94
|
+
...
|
|
95
|
+
|
|
96
|
+
@overload
|
|
97
|
+
def get_name(self, name_type: str, name: str) -> Name:
|
|
98
|
+
...
|
|
99
|
+
|
|
100
|
+
def get_name(self, name_type, name):
|
|
101
|
+
"""
|
|
102
|
+
Find the `Name` with the matching `name_type` and `name`
|
|
103
|
+
|
|
104
|
+
:return: The matched Name or None
|
|
105
|
+
:raises KeyError: If `name` in `name_type` wasn't present.
|
|
106
|
+
"""
|
|
107
|
+
if self._names:
|
|
108
|
+
for name_ in self._names:
|
|
109
|
+
if isinstance(name_type, str):
|
|
110
|
+
if name_.type.name == name_type and name_.name == name:
|
|
111
|
+
return name_
|
|
112
|
+
elif isinstance(name_type, NameType):
|
|
113
|
+
if name_.type == name_type and name_.name == name:
|
|
114
|
+
return name_
|
|
115
|
+
raise KeyError(name_type, name)
|
|
116
|
+
|
|
117
|
+
@overload
|
|
118
|
+
def get_names(self, name_type: NameType) -> List[Name]:
|
|
119
|
+
...
|
|
120
|
+
|
|
121
|
+
@overload
|
|
122
|
+
def get_names(self, name_type: str) -> List[Name]:
|
|
123
|
+
...
|
|
124
|
+
|
|
125
|
+
def get_names(self, name_type):
|
|
126
|
+
"""
|
|
127
|
+
Find all `Name` with the matching `name_type`
|
|
128
|
+
|
|
129
|
+
:return: A list of matching Name or None
|
|
130
|
+
:raises KeyError: If `name_type` wasn't present.
|
|
131
|
+
"""
|
|
132
|
+
matches = None
|
|
133
|
+
if self._names:
|
|
134
|
+
if isinstance(name_type, str):
|
|
135
|
+
matches = [name for name in self._names if name.type.name == name_type]
|
|
136
|
+
elif isinstance(name_type, NameType):
|
|
137
|
+
matches = [name for name in self._names if name.type == name_type]
|
|
138
|
+
|
|
139
|
+
if matches:
|
|
140
|
+
return matches
|
|
141
|
+
else:
|
|
142
|
+
raise KeyError(f"{name_type}")
|
|
143
|
+
|
|
144
|
+
def add_name(self, name_type: NameType, name: str) -> IdentifiedObject:
|
|
145
|
+
"""
|
|
146
|
+
Associate a `Name` with this `IdentifiedObject`
|
|
147
|
+
|
|
148
|
+
:param name_type: A `NameType` this `Name` belongs to.
|
|
149
|
+
:param name: A free string to associate with this `IdentifiedObject`.
|
|
150
|
+
:return: A reference to this `IdentifiedObject` to allow fluent use.
|
|
151
|
+
:raise ValueError: If `name` references another `IdentifiedObject`, or another `Name` already exists with the matching `type` and `name`.
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
name_obj = name_type.get_or_add_name(name, self)
|
|
155
|
+
|
|
156
|
+
if not name_obj.identified_object:
|
|
157
|
+
name_obj.identified_object = self
|
|
158
|
+
require(name_obj.identified_object is self, lambda: f"Attempting to add a Name to {str(self)} that does not reference this identified object")
|
|
159
|
+
|
|
160
|
+
if self.has_name(name_obj.type, name_obj.name):
|
|
161
|
+
existing = self.get_name(name_obj.type, name_obj.name)
|
|
162
|
+
if existing is name_obj:
|
|
163
|
+
return self
|
|
164
|
+
else:
|
|
165
|
+
raise ValueError(f"Failed to add duplicate name {str(name)} to {str(self)}.")
|
|
166
|
+
|
|
167
|
+
self._names = list() if not self._names else self._names
|
|
168
|
+
self._names.append(name_obj)
|
|
169
|
+
return self
|
|
170
|
+
|
|
171
|
+
def remove_name(self, name: Name) -> IdentifiedObject:
|
|
172
|
+
"""
|
|
173
|
+
Disassociate a `Name` from this `IdentifiedObject` and remove the `name` from its `nameType`
|
|
174
|
+
|
|
175
|
+
:param name: The `Name` to disassociate from this `IdentifiedObject`.
|
|
176
|
+
:return: A reference to this `IdentifiedObject` to allow fluent use.
|
|
177
|
+
:raises ValueError: If `name` was not associated with this `IdentifiedObject`.
|
|
178
|
+
"""
|
|
179
|
+
self._names = safe_remove(self._names, name)
|
|
180
|
+
|
|
181
|
+
# Remove the reverse reference from the NameType if it still exists.
|
|
182
|
+
if name.type.has_name(name):
|
|
183
|
+
name.type.remove_name(name)
|
|
184
|
+
|
|
185
|
+
return self
|
|
186
|
+
|
|
187
|
+
def clear_names(self) -> IdentifiedObject:
|
|
188
|
+
"""
|
|
189
|
+
Clear all names.
|
|
190
|
+
|
|
191
|
+
:return: A reference to this `IdentifiedObject` to allow fluent use.
|
|
192
|
+
"""
|
|
193
|
+
for name in list(self._names):
|
|
194
|
+
self.remove_name(name)
|
|
195
|
+
self._names = None
|
|
196
|
+
|
|
197
|
+
return self
|
|
198
|
+
|
|
199
|
+
def _validate_reference(self, other: IdentifiedObject, getter: Callable[[str], IdentifiedObject], type_descr: str) -> bool:
|
|
200
|
+
"""
|
|
201
|
+
Validate whether a given reference exists to `other` using the provided getter function.
|
|
202
|
+
|
|
203
|
+
:param other: The object to look up with the getter using its mRID.
|
|
204
|
+
:param getter: A function that takes an mRID and returns an `IdentifiedObject`, and throws a `KeyError` if it couldn't be found.
|
|
205
|
+
:param type_descr: The type description to use for the lazily generated error message. Should be of the form "A[n] type(other)"
|
|
206
|
+
:return: True if `other` was retrieved with `getter` and was equivalent, False otherwise.
|
|
207
|
+
:raises ValueError: If the object retrieved from `getter` is not `other`.
|
|
208
|
+
"""
|
|
209
|
+
try:
|
|
210
|
+
get_result = getter(other.mrid)
|
|
211
|
+
require(get_result is other, lambda: f"{type_descr} with mRID {other.mrid} already exists in {str(self)}")
|
|
212
|
+
return True
|
|
213
|
+
except (KeyError, AttributeError):
|
|
214
|
+
return False
|
|
215
|
+
|
|
216
|
+
def _validate_reference_by_field(self, other: IdentifiedObject, field: Any, getter: Callable[[Any], IdentifiedObject],
|
|
217
|
+
field_name: str) -> bool:
|
|
218
|
+
"""
|
|
219
|
+
Validate whether a given reference exists to `other` using the provided getter function called with `field`.
|
|
220
|
+
|
|
221
|
+
:param other: The object to look up with the getter using its mRID.
|
|
222
|
+
:param field: The value of the field from `other` that needs to be validated.
|
|
223
|
+
:param getter: A function that takes `field` and returns an `IdentifiedObject`, and throws an `IndexError` if it couldn't be found.
|
|
224
|
+
:param field_name: The name of the field to use for the lazily generated error message.
|
|
225
|
+
:return: True if `other` was retrieved with `getter` and was equivalent, False otherwise.
|
|
226
|
+
:raises ValueError: If the object retrieved from `getter` is not `other`.
|
|
227
|
+
"""
|
|
228
|
+
try:
|
|
229
|
+
get_result = getter(field)
|
|
230
|
+
require(get_result is other, lambda: f"Unable to add {other} to {self}. A {get_result} already exists with {field_name} {field}.")
|
|
231
|
+
return True
|
|
232
|
+
except IndexError:
|
|
233
|
+
return False
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
TIdentifiedObject = TypeVar("TIdentifiedObject", bound=IdentifiedObject)
|
|
237
|
+
"""
|
|
238
|
+
Generic type of IdentifiedObject which can be used for type hinting generics.
|
|
239
|
+
"""
|
|
@@ -0,0 +1,36 @@
|
|
|
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__ = ["Name"]
|
|
9
|
+
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from typing import TYPE_CHECKING, Optional
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from zepben.ewb.model.cim.iec61970.base.core.identified_object import IdentifiedObject
|
|
15
|
+
from zepben.ewb.model.cim.iec61970.base.core.name_type import NameType
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
#
|
|
19
|
+
# NOTE: unsafe_hash is used as we can't mark this class frozen due to needing to update/lazy initialise the identified_object, which shouldn't change once
|
|
20
|
+
# it has been initialised.
|
|
21
|
+
#
|
|
22
|
+
@dataclass(unsafe_hash=True)
|
|
23
|
+
class Name:
|
|
24
|
+
"""
|
|
25
|
+
The Name class provides the means to define any number of human-readable names for an object. A name is **not** to be used for defining inter-object
|
|
26
|
+
relationships. For inter-object relationships instead use the object identification 'mRID'.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
name: str
|
|
30
|
+
"""Any free text that name the object."""
|
|
31
|
+
|
|
32
|
+
type: NameType
|
|
33
|
+
"""Type of this name."""
|
|
34
|
+
|
|
35
|
+
identified_object: Optional[IdentifiedObject] = None
|
|
36
|
+
"""Identified object that this name designates."""
|
|
@@ -0,0 +1,203 @@
|
|
|
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__ = ["NameType"]
|
|
9
|
+
|
|
10
|
+
from typing import Dict, List, Generator, overload, TYPE_CHECKING, Callable, Optional
|
|
11
|
+
|
|
12
|
+
from zepben.ewb.dataclassy import dataclass
|
|
13
|
+
from zepben.ewb.model.cim.iec61970.base.core.name import Name
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from zepben.ewb.model.cim.iec61970.base.core.identified_object import IdentifiedObject
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(slots=True)
|
|
20
|
+
class NameType:
|
|
21
|
+
"""
|
|
22
|
+
Type of name. Possible values for attribute 'name' are implementation dependent but standard profiles may specify types. An enterprise may have multiple
|
|
23
|
+
IT systems each having its own local name for the same object, e.g. a planning system may have different names from an EMS. An object may also have
|
|
24
|
+
different names within the same IT system, e.g. localName as defined in CIM version 14. The definition from CIM14 is:
|
|
25
|
+
The localName is a human-readable name of the object. It is a free text name local to a node in a naming hierarchy similar to a file directory structure.
|
|
26
|
+
A power system related naming hierarchy may be: Substation, VoltageLevel, Equipment etc. Children of the same parent in such a hierarchy have names that
|
|
27
|
+
typically are unique among them.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
name: str
|
|
31
|
+
"""Name of the name type."""
|
|
32
|
+
|
|
33
|
+
description: Optional[str] = None
|
|
34
|
+
"""Description of the name type."""
|
|
35
|
+
|
|
36
|
+
_names_index: Dict[str, Name] = dict()
|
|
37
|
+
_names_multi_index: Dict[str, List[Name]] = dict()
|
|
38
|
+
|
|
39
|
+
def __str__(self):
|
|
40
|
+
return f"NameType(name='{self.name}', description='{self.description}')"
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def names(self) -> Generator[Name, None, None]:
|
|
44
|
+
"""All names of this type."""
|
|
45
|
+
for names_ in self._names_multi_index.values():
|
|
46
|
+
for name in names_:
|
|
47
|
+
yield name
|
|
48
|
+
|
|
49
|
+
for name_ in self._names_index.values():
|
|
50
|
+
yield name_
|
|
51
|
+
|
|
52
|
+
@overload
|
|
53
|
+
def has_name(self, name: str):
|
|
54
|
+
"""Indicates if this :class:`NameType` contains `Name` with `name`."""
|
|
55
|
+
|
|
56
|
+
@overload
|
|
57
|
+
def has_name(self, name: Name):
|
|
58
|
+
"""Indicates if this :class:`NameType` contains specific `name`."""
|
|
59
|
+
|
|
60
|
+
def has_name(self, name):
|
|
61
|
+
if isinstance(name, str):
|
|
62
|
+
return name in self._names_index or name in self._names_multi_index
|
|
63
|
+
if isinstance(name, Name):
|
|
64
|
+
return name in self._names_index.values() or name in self._names_multi_index.values()
|
|
65
|
+
|
|
66
|
+
@overload
|
|
67
|
+
def get_names(self, name: str) -> Generator[Name, None, None]:
|
|
68
|
+
...
|
|
69
|
+
|
|
70
|
+
@overload
|
|
71
|
+
def get_names(self, io) -> Generator[Name, None, None]:
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
def get_names(self, name_or_io) -> Generator[Name, None, None]:
|
|
75
|
+
"""Get all the :class:`Name` instances for the provided `name` or `IdentifiedObject`.
|
|
76
|
+
|
|
77
|
+
:return: A `Generator` of `Name`
|
|
78
|
+
"""
|
|
79
|
+
if isinstance(name_or_io, str):
|
|
80
|
+
try:
|
|
81
|
+
yield self._names_index[name_or_io]
|
|
82
|
+
except KeyError:
|
|
83
|
+
try:
|
|
84
|
+
for name_ in self._names_multi_index[name_or_io]:
|
|
85
|
+
yield name_
|
|
86
|
+
except KeyError:
|
|
87
|
+
pass
|
|
88
|
+
else:
|
|
89
|
+
try:
|
|
90
|
+
for name_ in self._names_index.values():
|
|
91
|
+
if name_.identified_object == name_or_io:
|
|
92
|
+
yield name_
|
|
93
|
+
for names in self._names_multi_index.values():
|
|
94
|
+
for name_ in names:
|
|
95
|
+
if name_.identified_object == name_or_io:
|
|
96
|
+
yield name_
|
|
97
|
+
except KeyError:
|
|
98
|
+
pass
|
|
99
|
+
|
|
100
|
+
def get_or_add_name(self, name: str, identified_object: IdentifiedObject) -> Name:
|
|
101
|
+
"""
|
|
102
|
+
Gets a :class:`Name` for the given `name` and `identifiedObject` combination or adds a new :class:`Name`
|
|
103
|
+
to this :class:`NameType` with the combination and returns the new instance.
|
|
104
|
+
"""
|
|
105
|
+
if name in self._names_index:
|
|
106
|
+
existing = self._names_index[name]
|
|
107
|
+
if existing.identified_object is identified_object:
|
|
108
|
+
return existing
|
|
109
|
+
|
|
110
|
+
def move_to_multi_index(name_obj: Name):
|
|
111
|
+
self._names_multi_index[name] = [existing, name_obj]
|
|
112
|
+
del self._names_index[name]
|
|
113
|
+
|
|
114
|
+
return self._get_or_create_name(name, identified_object, move_to_multi_index)
|
|
115
|
+
elif name in self._names_multi_index:
|
|
116
|
+
for n in self._names_multi_index[name]:
|
|
117
|
+
if n.identified_object is identified_object:
|
|
118
|
+
return n
|
|
119
|
+
|
|
120
|
+
def expand_multi_index(name_obj: Name):
|
|
121
|
+
self._names_multi_index[name].append(name_obj)
|
|
122
|
+
|
|
123
|
+
return self._get_or_create_name(name, identified_object, expand_multi_index)
|
|
124
|
+
else:
|
|
125
|
+
def add_to_index(name_obj: Name):
|
|
126
|
+
self._names_index[name] = name_obj
|
|
127
|
+
|
|
128
|
+
return self._get_or_create_name(name, identified_object, add_to_index)
|
|
129
|
+
|
|
130
|
+
def remove_name(self, name: Name) -> NameType:
|
|
131
|
+
"""
|
|
132
|
+
Removes the `name` from this name type.
|
|
133
|
+
Removes the `name` from associated `IdentifiedObject`
|
|
134
|
+
|
|
135
|
+
:return: True if the name instance was successfully removed
|
|
136
|
+
"""
|
|
137
|
+
if name.type is not self:
|
|
138
|
+
raise ValueError(f"NameType.remove_name(name): {name} not in {self}")
|
|
139
|
+
|
|
140
|
+
try:
|
|
141
|
+
del self._names_index[name.name]
|
|
142
|
+
if name.identified_object.get_name(name.type, name.name):
|
|
143
|
+
name.identified_object.remove_name(name)
|
|
144
|
+
return self
|
|
145
|
+
except KeyError:
|
|
146
|
+
try:
|
|
147
|
+
names = self._names_multi_index[name.name]
|
|
148
|
+
names.remove(name)
|
|
149
|
+
if not names:
|
|
150
|
+
del self._names_multi_index[name.name]
|
|
151
|
+
name.identified_object.remove_name(name)
|
|
152
|
+
return self
|
|
153
|
+
except KeyError:
|
|
154
|
+
return self
|
|
155
|
+
|
|
156
|
+
def remove_names(self, name: str) -> NameType:
|
|
157
|
+
"""
|
|
158
|
+
Removes all :class:`Name` instances associated with name `name`.
|
|
159
|
+
|
|
160
|
+
:return: True if a matching name was removed.
|
|
161
|
+
"""
|
|
162
|
+
try:
|
|
163
|
+
name_obj = self._names_index[name]
|
|
164
|
+
del self._names_index[name]
|
|
165
|
+
name_obj.identified_object.remove_name(name_obj)
|
|
166
|
+
return self
|
|
167
|
+
except KeyError:
|
|
168
|
+
try:
|
|
169
|
+
name_list = list(self._names_multi_index[name])
|
|
170
|
+
del self._names_multi_index[name]
|
|
171
|
+
for name_obj in name_list:
|
|
172
|
+
name_obj.identified_object.remove_name(name_obj)
|
|
173
|
+
return self
|
|
174
|
+
except KeyError:
|
|
175
|
+
return self
|
|
176
|
+
|
|
177
|
+
def clear_names(self) -> NameType:
|
|
178
|
+
for name in list(self._names_index.values()):
|
|
179
|
+
name.identified_object.remove_name(name)
|
|
180
|
+
for names in list(self._names_multi_index.values()):
|
|
181
|
+
for name in names:
|
|
182
|
+
name.identified_object.remove_name(name)
|
|
183
|
+
self._names_index = dict()
|
|
184
|
+
self._names_multi_index = dict()
|
|
185
|
+
return self
|
|
186
|
+
|
|
187
|
+
def _get_or_create_name(self, name: str, identified_object: IdentifiedObject, update_index: Callable[[Name], None]) -> Name:
|
|
188
|
+
#
|
|
189
|
+
# NOTE: In Python, we can add names directly into the names collection of an object, so there is a chance that we just need to update the index rather
|
|
190
|
+
# than create a new Name class
|
|
191
|
+
#
|
|
192
|
+
had_name = identified_object.has_name(self, name)
|
|
193
|
+
if had_name:
|
|
194
|
+
name_obj = identified_object.get_name(self, name)
|
|
195
|
+
else:
|
|
196
|
+
name_obj = Name(name, self, identified_object)
|
|
197
|
+
|
|
198
|
+
update_index(name_obj)
|
|
199
|
+
|
|
200
|
+
if not had_name:
|
|
201
|
+
identified_object.add_name(self, name)
|
|
202
|
+
|
|
203
|
+
return name_obj
|
|
@@ -0,0 +1,202 @@
|
|
|
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
|
+
__all__ = ["PhaseCode", "phase_code_by_id", "phase_code_from_single_phases"]
|
|
7
|
+
|
|
8
|
+
from enum import Enum
|
|
9
|
+
from typing import List, Set, Union
|
|
10
|
+
|
|
11
|
+
from zepben.ewb import unique
|
|
12
|
+
from zepben.ewb.model.cim.iec61970.base.wires.single_phase_kind import SinglePhaseKind
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def phase_code_by_id(value: int):
|
|
16
|
+
"""
|
|
17
|
+
Get a PhaseCode by its value
|
|
18
|
+
|
|
19
|
+
`value` ID of the PhaseCode from 0 as per the order of definition
|
|
20
|
+
Returns The PhaseCode
|
|
21
|
+
"""
|
|
22
|
+
return _PHASE_CODE_VALUES[value]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@unique
|
|
26
|
+
class PhaseCode(Enum):
|
|
27
|
+
"""
|
|
28
|
+
An unordered enumeration of phase identifiers. Allows designation of phases for both transmission and distribution equipment,
|
|
29
|
+
circuits and loads. The enumeration, by itself, does not describe how the phases are connected together or connected to ground.
|
|
30
|
+
Ground is not explicitly denoted as a phase.
|
|
31
|
+
|
|
32
|
+
Residential and small commercial loads are often served from single-phase, or split-phase, secondary circuits. For example of s12N,
|
|
33
|
+
phases 1 and 2 refer to hot wires that are 180 degrees out of phase, while N refers to the neutral wire. Through single-phase
|
|
34
|
+
transformer connections, these secondary circuits may be served from one or two of the primary phases A, B, and C. For three-phase
|
|
35
|
+
loads, use the A, B, C phase codes instead of s12N.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
NONE = (0, [SinglePhaseKind.NONE])
|
|
39
|
+
"""No phases specified"""
|
|
40
|
+
|
|
41
|
+
A = (1, [SinglePhaseKind.A])
|
|
42
|
+
"""Phase A"""
|
|
43
|
+
|
|
44
|
+
B = (2, [SinglePhaseKind.B])
|
|
45
|
+
"""Phase B"""
|
|
46
|
+
|
|
47
|
+
C = (3, [SinglePhaseKind.C])
|
|
48
|
+
"""Phase C"""
|
|
49
|
+
|
|
50
|
+
N = (4, [SinglePhaseKind.N])
|
|
51
|
+
"""Neutral Phase"""
|
|
52
|
+
|
|
53
|
+
AB = (5, [SinglePhaseKind.A, SinglePhaseKind.B])
|
|
54
|
+
"""Phases A and B"""
|
|
55
|
+
|
|
56
|
+
AC = (6, [SinglePhaseKind.A, SinglePhaseKind.C])
|
|
57
|
+
"""Phases A and C"""
|
|
58
|
+
|
|
59
|
+
AN = (7, [SinglePhaseKind.A, SinglePhaseKind.N])
|
|
60
|
+
"""Phases A and N"""
|
|
61
|
+
|
|
62
|
+
BC = (8, [SinglePhaseKind.B, SinglePhaseKind.C])
|
|
63
|
+
"""Phases B and C"""
|
|
64
|
+
|
|
65
|
+
BN = (9, [SinglePhaseKind.B, SinglePhaseKind.N])
|
|
66
|
+
"""Phases B and N"""
|
|
67
|
+
|
|
68
|
+
CN = (10, [SinglePhaseKind.C, SinglePhaseKind.N])
|
|
69
|
+
"""Phases C and N"""
|
|
70
|
+
|
|
71
|
+
ABC = (11, [SinglePhaseKind.A, SinglePhaseKind.B, SinglePhaseKind.C])
|
|
72
|
+
"""Phases A, B and C"""
|
|
73
|
+
|
|
74
|
+
ABN = (12, [SinglePhaseKind.A, SinglePhaseKind.B, SinglePhaseKind.N])
|
|
75
|
+
"""Phases A, B and neutral"""
|
|
76
|
+
|
|
77
|
+
ACN = (13, [SinglePhaseKind.A, SinglePhaseKind.C, SinglePhaseKind.N])
|
|
78
|
+
"""Phases A, C and neutral"""
|
|
79
|
+
|
|
80
|
+
BCN = (14, [SinglePhaseKind.B, SinglePhaseKind.C, SinglePhaseKind.N])
|
|
81
|
+
"""Phases B, C and neutral"""
|
|
82
|
+
|
|
83
|
+
ABCN = (15, [SinglePhaseKind.A, SinglePhaseKind.B, SinglePhaseKind.C, SinglePhaseKind.N])
|
|
84
|
+
"""Phases A, B, C and neutral"""
|
|
85
|
+
|
|
86
|
+
X = (16, [SinglePhaseKind.X])
|
|
87
|
+
"""Unknown non-neutral phase"""
|
|
88
|
+
|
|
89
|
+
XN = (17, [SinglePhaseKind.X, SinglePhaseKind.N])
|
|
90
|
+
"""Unknown non-neutral phase plus neutral"""
|
|
91
|
+
|
|
92
|
+
XY = (18, [SinglePhaseKind.X, SinglePhaseKind.Y])
|
|
93
|
+
"""Two Unknown non-neutral phases"""
|
|
94
|
+
|
|
95
|
+
XYN = (19, [SinglePhaseKind.X, SinglePhaseKind.Y, SinglePhaseKind.N])
|
|
96
|
+
"""Two Unknown non-neutral phases plus neutral"""
|
|
97
|
+
|
|
98
|
+
Y = (20, [SinglePhaseKind.Y])
|
|
99
|
+
"""Unknown non-neutral phase"""
|
|
100
|
+
|
|
101
|
+
YN = (21, [SinglePhaseKind.Y, SinglePhaseKind.N])
|
|
102
|
+
"""Unknown non-neutral phase plus neutral"""
|
|
103
|
+
|
|
104
|
+
# pylint: disable=invalid-name
|
|
105
|
+
s1 = (22, [SinglePhaseKind.s1])
|
|
106
|
+
"""Secondary phase 1"""
|
|
107
|
+
|
|
108
|
+
s1N = (23, [SinglePhaseKind.s1, SinglePhaseKind.N])
|
|
109
|
+
"""Secondary phase 1 plus neutral"""
|
|
110
|
+
|
|
111
|
+
s12 = (24, [SinglePhaseKind.s1, SinglePhaseKind.s2])
|
|
112
|
+
"""Secondary phase 1 and 2"""
|
|
113
|
+
|
|
114
|
+
s12N = (25, [SinglePhaseKind.s1, SinglePhaseKind.s2, SinglePhaseKind.N])
|
|
115
|
+
"""Secondary phases 1, 2, and neutral"""
|
|
116
|
+
|
|
117
|
+
s2 = (26, [SinglePhaseKind.s2])
|
|
118
|
+
"""Secondary phase 2"""
|
|
119
|
+
|
|
120
|
+
s2N = (27, [SinglePhaseKind.s2, SinglePhaseKind.N])
|
|
121
|
+
"""Secondary phase 2 plus neutral"""
|
|
122
|
+
|
|
123
|
+
# pylint: enable=invalid-name
|
|
124
|
+
|
|
125
|
+
@property
|
|
126
|
+
def short_name(self) -> str:
|
|
127
|
+
"""Get the name of this `PhaseCode` without the class qualifier"""
|
|
128
|
+
return str(self)[10:]
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def single_phases(self) -> List[SinglePhaseKind]:
|
|
132
|
+
"""Get the list of `SinglePhaseKind` that make up this `PhaseCode`"""
|
|
133
|
+
return self.value[1]
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def num_phases(self) -> int:
|
|
137
|
+
"""
|
|
138
|
+
Get the number of `SinglePhaseKind` that make up this `PhaseCode`. This is the same as the length of the `single_phases` in all cases except for NONE,
|
|
139
|
+
where the number of phases will be 0.
|
|
140
|
+
"""
|
|
141
|
+
return len(self.value[1]) if self != PhaseCode.NONE else 0
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def without_neutral(self) -> 'PhaseCode':
|
|
145
|
+
"""Get the equivalent `PhaseCode` without the `N` phase."""
|
|
146
|
+
if SinglePhaseKind.N not in self:
|
|
147
|
+
return self
|
|
148
|
+
else:
|
|
149
|
+
return phase_code_from_single_phases({it for it in self.single_phases if it != SinglePhaseKind.N})
|
|
150
|
+
|
|
151
|
+
def __iter__(self):
|
|
152
|
+
return PhaseCodeIter(self.single_phases)
|
|
153
|
+
|
|
154
|
+
def __contains__(self, item):
|
|
155
|
+
return item in self.single_phases
|
|
156
|
+
|
|
157
|
+
def __add__(self, other: Union[SinglePhaseKind, 'PhaseCode']) -> 'PhaseCode':
|
|
158
|
+
if isinstance(other, SinglePhaseKind):
|
|
159
|
+
return phase_code_from_single_phases(set(self.single_phases + [other]))
|
|
160
|
+
elif isinstance(other, PhaseCode):
|
|
161
|
+
return phase_code_from_single_phases(set(self.single_phases + other.single_phases))
|
|
162
|
+
else:
|
|
163
|
+
return PhaseCode.NONE
|
|
164
|
+
|
|
165
|
+
def __sub__(self, other: Union[SinglePhaseKind, 'PhaseCode']) -> 'PhaseCode':
|
|
166
|
+
if isinstance(other, SinglePhaseKind):
|
|
167
|
+
return phase_code_from_single_phases({it for it in self.single_phases if it != other})
|
|
168
|
+
elif isinstance(other, PhaseCode):
|
|
169
|
+
return phase_code_from_single_phases({it for it in self.single_phases if it not in other.single_phases})
|
|
170
|
+
else:
|
|
171
|
+
return PhaseCode.NONE
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class PhaseCodeIter:
|
|
175
|
+
"""
|
|
176
|
+
An iterator that can be used to iterate over the `SinglePhaseKind` of a `PhaseCode`
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
def __init__(self, single_phases: List[SinglePhaseKind]):
|
|
180
|
+
self._index = -1
|
|
181
|
+
self._single_phases = single_phases
|
|
182
|
+
|
|
183
|
+
def __iter__(self):
|
|
184
|
+
return self
|
|
185
|
+
|
|
186
|
+
def __next__(self):
|
|
187
|
+
self._index += 1
|
|
188
|
+
if self._index < len(self._single_phases):
|
|
189
|
+
return self._single_phases[self._index]
|
|
190
|
+
raise StopIteration
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def phase_code_from_single_phases(single_phases: Set[SinglePhaseKind]) -> PhaseCode:
|
|
194
|
+
"""Get the `PhaseCode` that is made up of the set of `SinglePhaseKind`, or `PhaseCode.NONE` if it is not valid."""
|
|
195
|
+
return _PHASE_CODE_BY_PHASES.get(frozenset(single_phases), PhaseCode.NONE)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
_PHASE_CODE_VALUES = list(PhaseCode.__members__.values())
|
|
199
|
+
|
|
200
|
+
# The IDE is detecting `it` as a `SinglePhaseKind` rather than a `PhaseCode`
|
|
201
|
+
# noinspection PyUnresolvedReferences
|
|
202
|
+
_PHASE_CODE_BY_PHASES = {frozenset(it.single_phases): it for it in PhaseCode}
|