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.
- 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/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 +173 -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/column.py +37 -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 +142 -0
- zepben/ewb/database/sqlite/tables/table_metadata_data_sources.py +21 -0
- zepben/ewb/database/sqlite/tables/table_version.py +38 -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 +35 -0
- zepben/ewb/model/cim/extensions/iec61970/base/protection/protection_kind.py +113 -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 +82 -0
- zepben/ewb/model/cim/extensions/iec61970/base/wires/transformer_cooling_type.py +56 -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 +292 -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 +55 -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 +45 -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 +67 -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 +67 -0
- zepben/ewb/model/cim/iec61968/infiec61968/infassetinfo/transformer_function_kind.py +43 -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 +25 -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 +150 -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 +46 -0
- zepben/ewb/model/cim/iec61968/metering/meter.py +26 -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 +28 -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 +124 -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 +234 -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 +201 -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 +26 -0
- zepben/ewb/model/cim/iec61970/base/diagramlayout/orientation_kind.py +27 -0
- zepben/ewb/model/cim/iec61970/base/domain/__init__.py +4 -0
- zepben/ewb/model/cim/iec61970/base/domain/unit_symbol.py +492 -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 +37 -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 +16 -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 +38 -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 +46 -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 +105 -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 +28 -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 +44 -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 +43 -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 +92 -0
- zepben/ewb/services/common/translator/base_proto2cim.py +112 -0
- zepben/ewb/services/common/translator/service_differences.py +81 -0
- zepben/ewb/services/common/translator/util.py +78 -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 +34 -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 +71 -0
- zepben/ewb/services/network/tracing/networktrace/actions/tree_node.py +37 -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 +450 -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 +125 -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 +1782 -0
- zepben/ewb/services/network/translator/network_enum_mappers.py +78 -0
- zepben/ewb/services/network/translator/network_proto2cim.py +2147 -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 +34 -0
- zepben/ewb/streaming/get/included_energizing_containers.py +34 -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 +185 -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 +189 -0
- zepben_ewb-1.0.0b1.dist-info/METADATA +102 -0
- zepben_ewb-1.0.0b1.dist-info/RECORD +639 -0
- zepben_ewb-1.0.0b1.dist-info/WHEEL +5 -0
- zepben_ewb-1.0.0b1.dist-info/licenses/LICENSE +374 -0
- zepben_ewb-1.0.0b1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,50 @@
|
|
|
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__ = ["BaseServiceReader"]
|
|
7
|
+
|
|
8
|
+
from abc import ABC, abstractmethod
|
|
9
|
+
from sqlite3 import Connection
|
|
10
|
+
|
|
11
|
+
from zepben.ewb.database.sqlite.common.base_cim_reader import BaseCimReader
|
|
12
|
+
from zepben.ewb.database.sqlite.common.base_collection_reader import BaseCollectionReader
|
|
13
|
+
from zepben.ewb.database.sqlite.common.base_database_tables import BaseDatabaseTables
|
|
14
|
+
from zepben.ewb.database.sqlite.tables.iec61970.base.core.table_name_types import TableNameTypes
|
|
15
|
+
from zepben.ewb.database.sqlite.tables.iec61970.base.core.table_names import TableNames
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class BaseServiceReader(BaseCollectionReader, ABC):
|
|
19
|
+
"""
|
|
20
|
+
A base class for reading items stored in a `BaseService` from the database.
|
|
21
|
+
|
|
22
|
+
:param tables: The tables available in the database.
|
|
23
|
+
:param connection: A connection to the database.
|
|
24
|
+
:param reader: The `BaseCimReader` used to load the objects from the database.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
tables: BaseDatabaseTables,
|
|
30
|
+
connection: Connection,
|
|
31
|
+
reader: BaseCimReader
|
|
32
|
+
):
|
|
33
|
+
super().__init__(tables, connection)
|
|
34
|
+
self._reader: BaseCimReader = reader
|
|
35
|
+
"""
|
|
36
|
+
The `BaseCimReader` used to load the objects from the database.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
def load(self) -> bool:
|
|
40
|
+
return (self._do_load()
|
|
41
|
+
and self._load_each(TableNameTypes, self._reader.load_name_types)
|
|
42
|
+
and self._load_each(TableNames, self._reader.load_names))
|
|
43
|
+
|
|
44
|
+
@abstractmethod
|
|
45
|
+
def _do_load(self) -> bool:
|
|
46
|
+
"""
|
|
47
|
+
Load the service specific objects from the database.
|
|
48
|
+
|
|
49
|
+
:return: True if the objects were successfully loaded from the database, otherwise False
|
|
50
|
+
"""
|
|
@@ -0,0 +1,104 @@
|
|
|
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__ = ["BaseServiceWriter"]
|
|
7
|
+
|
|
8
|
+
from abc import ABC, abstractmethod
|
|
9
|
+
from typing import Callable, Type
|
|
10
|
+
|
|
11
|
+
from zepben.ewb.database.sqlite.common.base_cim_writer import BaseCimWriter
|
|
12
|
+
from zepben.ewb.database.sqlite.common.base_collection_writer import BaseCollectionWriter
|
|
13
|
+
from zepben.ewb.model.cim.iec61970.base.core.identified_object import TIdentifiedObject
|
|
14
|
+
from zepben.ewb.model.cim.iec61970.base.core.name import Name
|
|
15
|
+
from zepben.ewb.model.cim.iec61970.base.core.name_type import NameType
|
|
16
|
+
from zepben.ewb.services.common.base_service import BaseService
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class BaseServiceWriter(BaseCollectionWriter, ABC):
|
|
20
|
+
"""
|
|
21
|
+
A base class for writing object from a [BaseService] into the database.
|
|
22
|
+
|
|
23
|
+
:param service: The `BaseService` to save to the database.
|
|
24
|
+
:param writer: The `BaseServiceWriter` used to actually write the objects to the database.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self, service: BaseService, writer: BaseCimWriter):
|
|
28
|
+
super().__init__()
|
|
29
|
+
self._service: BaseService = service
|
|
30
|
+
"""
|
|
31
|
+
The `BaseService` to save to the database.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
self._writer: BaseCimWriter = writer
|
|
35
|
+
"""
|
|
36
|
+
The `BaseServiceWriter` used to actually write the objects to the database.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
def save(self) -> bool:
|
|
40
|
+
return all([self._save_name_types(), self._do_save()])
|
|
41
|
+
|
|
42
|
+
@abstractmethod
|
|
43
|
+
def _do_save(self) -> bool:
|
|
44
|
+
"""
|
|
45
|
+
Save the service specific objects to the database.
|
|
46
|
+
|
|
47
|
+
:return: True if the objects were successfully saved to the database, otherwise False
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
"""
|
|
51
|
+
Save each object of the specified type using the provided `saver`.
|
|
52
|
+
|
|
53
|
+
@param T The type of object to save to the database.
|
|
54
|
+
@param saver The callback used to save the objects to the database. Will be called once for each object and should return True if the object is
|
|
55
|
+
successfully saved to the database.
|
|
56
|
+
|
|
57
|
+
:return: True if all objects are successfully saved to the database, otherwise False.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
def _save_each_object(self, type_: Type[TIdentifiedObject], saver: Callable[[TIdentifiedObject], bool]) -> bool:
|
|
61
|
+
status = True
|
|
62
|
+
for it in self._service.objects(type_):
|
|
63
|
+
status = status and self._validate_save_object(it, saver)
|
|
64
|
+
|
|
65
|
+
return status
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
Validate that an object is actually saved to the database, logging an error if anything goes wrong.
|
|
69
|
+
|
|
70
|
+
@param T The type of object being saved.
|
|
71
|
+
@param it The object being saved.
|
|
72
|
+
@param saver The callback actually saving the object to the database.
|
|
73
|
+
|
|
74
|
+
:return: True if the object is successfully saved to the database, otherwise False.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
def _validate_save_object(self, it: TIdentifiedObject, saver: Callable[[TIdentifiedObject], bool]) -> bool:
|
|
78
|
+
def log_error(e: Exception):
|
|
79
|
+
self._logger.error(f"Failed to save {it.__class__.__name__} {it.name} [{it.mrid}]: {e}")
|
|
80
|
+
|
|
81
|
+
return self._validate_save(it, saver, log_error)
|
|
82
|
+
|
|
83
|
+
def _save_name_types(self) -> bool:
|
|
84
|
+
status = True
|
|
85
|
+
|
|
86
|
+
for it in self._service.name_types:
|
|
87
|
+
status = all([status, self._validate_save_name_type(it, self._writer.save_name_type)])
|
|
88
|
+
|
|
89
|
+
for name in it.names:
|
|
90
|
+
status = all([status, self._validate_save_name(name, self._writer.save_name)])
|
|
91
|
+
|
|
92
|
+
return status
|
|
93
|
+
|
|
94
|
+
def _validate_save_name_type(self, name_type: NameType, saver: Callable[[NameType], bool]) -> bool:
|
|
95
|
+
def log_error(e: Exception):
|
|
96
|
+
self._logger.error(f"Failed to save {name_type.__class__.__name__} {name_type.name}: {e}")
|
|
97
|
+
|
|
98
|
+
return self._validate_save(name_type, saver, log_error)
|
|
99
|
+
|
|
100
|
+
def _validate_save_name(self, name: Name, saver: Callable[[Name], bool]) -> bool:
|
|
101
|
+
def log_error(e: Exception):
|
|
102
|
+
self._logger.error(f"Failed to save {name.__class__.__name__} {name.name}: {e}")
|
|
103
|
+
|
|
104
|
+
return self._validate_save(name, saver, log_error)
|
|
@@ -0,0 +1,39 @@
|
|
|
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__ = ["MetadataCollectionReader"]
|
|
7
|
+
|
|
8
|
+
from sqlite3 import Connection
|
|
9
|
+
|
|
10
|
+
from zepben.ewb.database.sqlite.common.base_collection_reader import BaseCollectionReader
|
|
11
|
+
from zepben.ewb.database.sqlite.common.base_database_tables import BaseDatabaseTables
|
|
12
|
+
from zepben.ewb.database.sqlite.common.metadata_entry_reader import MetadataEntryReader
|
|
13
|
+
from zepben.ewb.database.sqlite.tables.table_metadata_data_sources import TableMetadataDataSources
|
|
14
|
+
from zepben.ewb.services.common.base_service import BaseService
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class MetadataCollectionReader(BaseCollectionReader):
|
|
18
|
+
"""
|
|
19
|
+
Class for reading the `MetadataCollection` from the database.
|
|
20
|
+
|
|
21
|
+
:param service: The `BaseService` containing the `MetadataCollection` to populate from the database.
|
|
22
|
+
:param tables: The tables available in the database.
|
|
23
|
+
:param connection: The `Connection` to the database.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(
|
|
27
|
+
self,
|
|
28
|
+
service: BaseService,
|
|
29
|
+
tables: BaseDatabaseTables,
|
|
30
|
+
connection: Connection,
|
|
31
|
+
reader: MetadataEntryReader = None
|
|
32
|
+
):
|
|
33
|
+
super().__init__(tables, connection)
|
|
34
|
+
self._reader: MetadataEntryReader = reader if reader is not None else MetadataEntryReader(service)
|
|
35
|
+
|
|
36
|
+
def load(self) -> bool:
|
|
37
|
+
return all([
|
|
38
|
+
self._load_each(TableMetadataDataSources, self._reader.load_metadata)
|
|
39
|
+
])
|
|
@@ -0,0 +1,38 @@
|
|
|
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__ = ["MetadataCollectionWriter"]
|
|
7
|
+
|
|
8
|
+
from zepben.ewb.database.sqlite.common.base_collection_writer import BaseCollectionWriter
|
|
9
|
+
from zepben.ewb.database.sqlite.common.base_database_tables import BaseDatabaseTables
|
|
10
|
+
from zepben.ewb.database.sqlite.common.metadata_entry_writer import MetadataEntryWriter
|
|
11
|
+
from zepben.ewb.services.common.base_service import BaseService
|
|
12
|
+
from zepben.ewb.services.common.meta.data_source import DataSource
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class MetadataCollectionWriter(BaseCollectionWriter):
|
|
16
|
+
"""
|
|
17
|
+
Class for writing the `MetadataCollection` to the database.
|
|
18
|
+
|
|
19
|
+
:param service: The `BaseService` containing the `MetadataCollection` to save to the database.
|
|
20
|
+
:param database_tables: The tables available in the database.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
service: BaseService,
|
|
26
|
+
database_tables: BaseDatabaseTables,
|
|
27
|
+
writer: MetadataEntryWriter = None
|
|
28
|
+
):
|
|
29
|
+
super().__init__()
|
|
30
|
+
self._service: BaseService = service
|
|
31
|
+
self._writer: MetadataEntryWriter = writer if writer is not None else MetadataEntryWriter(database_tables)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def save(self) -> bool:
|
|
35
|
+
def log_error(it: DataSource, e: Exception):
|
|
36
|
+
self._logger.error(f"Failed to save {it}: {e}")
|
|
37
|
+
|
|
38
|
+
return self._save_each(self._service.metadata.data_sources, self._writer.save_data_source, log_error)
|
|
@@ -0,0 +1,45 @@
|
|
|
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__ = ["MetadataEntryReader"]
|
|
7
|
+
|
|
8
|
+
import datetime
|
|
9
|
+
from typing import Callable
|
|
10
|
+
|
|
11
|
+
from zepben.ewb.database.sqlite.extensions.result_set import ResultSet
|
|
12
|
+
from zepben.ewb.database.sqlite.tables.table_metadata_data_sources import TableMetadataDataSources
|
|
13
|
+
from zepben.ewb.services.common.base_service import BaseService
|
|
14
|
+
from zepben.ewb.services.common.meta.data_source import DataSource
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class MetadataEntryReader:
|
|
18
|
+
"""
|
|
19
|
+
A class for reading the `MetadataCollection` entries from the database.
|
|
20
|
+
|
|
21
|
+
:param service: The `BaseService` containing the `MetadataCollection` to populate from the database.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, service: BaseService):
|
|
25
|
+
super().__init__()
|
|
26
|
+
self._service: BaseService = service
|
|
27
|
+
|
|
28
|
+
def load_metadata(self, table: TableMetadataDataSources, result_set: ResultSet, set_identifier: Callable[[str], str]) -> bool:
|
|
29
|
+
"""
|
|
30
|
+
Populate the `DataSource` fields from `TableMetadataDataSources`.
|
|
31
|
+
|
|
32
|
+
:param table: The database table to read the `DataSource` fields from.
|
|
33
|
+
:param result_set: The record in the database table containing the fields for this `DataSource`.
|
|
34
|
+
:param set_identifier: A callback to set the identifier of the current row for logging purposes, which returns a copy of the provided string for
|
|
35
|
+
fluent use.
|
|
36
|
+
|
|
37
|
+
:return: True if the `DataSource` is successfully loaded from the database, otherwise False.
|
|
38
|
+
"""
|
|
39
|
+
data_source = DataSource(
|
|
40
|
+
set_identifier(result_set.get_string(table.source.query_index)),
|
|
41
|
+
result_set.get_string(table.version.query_index),
|
|
42
|
+
result_set.get_instant(table.timestamp.query_index, datetime.datetime(1970, 1, 1))
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return self._service.metadata.add(data_source)
|
|
@@ -0,0 +1,41 @@
|
|
|
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__ = ["MetadataEntryWriter"]
|
|
7
|
+
|
|
8
|
+
from zepben.ewb.database.sqlite.common.base_database_tables import BaseDatabaseTables
|
|
9
|
+
from zepben.ewb.database.sqlite.common.base_entry_writer import BaseEntryWriter
|
|
10
|
+
from zepben.ewb.database.sqlite.tables.table_metadata_data_sources import TableMetadataDataSources
|
|
11
|
+
from zepben.ewb.services.common.meta.data_source import DataSource
|
|
12
|
+
|
|
13
|
+
class MetadataEntryWriter(BaseEntryWriter):
|
|
14
|
+
"""
|
|
15
|
+
A class for reading the `MetadataCollection` entries from the database.
|
|
16
|
+
|
|
17
|
+
@param database_tables The tables that are available in the database.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, database_tables: BaseDatabaseTables):
|
|
21
|
+
super().__init__()
|
|
22
|
+
self._database_tables: BaseDatabaseTables = database_tables
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def save_data_source(self, data_source: DataSource) -> bool:
|
|
26
|
+
"""
|
|
27
|
+
Save the `DataSource` fields to `TableMetadataDataSources`.
|
|
28
|
+
|
|
29
|
+
@param data_source The `DataSource` to save to the database.
|
|
30
|
+
|
|
31
|
+
@return true if the `DataSource` is successfully written to the database, otherwise false.
|
|
32
|
+
"""
|
|
33
|
+
table = self._database_tables.get_table(TableMetadataDataSources)
|
|
34
|
+
insert = self._database_tables.get_insert(TableMetadataDataSources)
|
|
35
|
+
|
|
36
|
+
insert.add_value(table.source.query_index, data_source.source)
|
|
37
|
+
insert.add_value(table.version.query_index, data_source.version)
|
|
38
|
+
# The timestamp in the database uses Z for UTC while python uses +HH:mm format, so convert between them.
|
|
39
|
+
insert.add_value(table.timestamp.query_index, f"{data_source.timestamp.isoformat()}Z")
|
|
40
|
+
|
|
41
|
+
return insert.try_execute_single_update(lambda ex: insert.log_failure(self._logger, "data source", ex))
|
|
@@ -0,0 +1,30 @@
|
|
|
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__ = ["MRIDLookupException", "NameTypeLookupException", "DuplicateMRIDException", "DuplicateNameTypeException"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MRIDLookupException(Exception):
|
|
10
|
+
"""
|
|
11
|
+
An exception indicating that an mRID could not be found in a [BaseService].
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class NameTypeLookupException(Exception):
|
|
16
|
+
"""
|
|
17
|
+
An exception indicating that a [NameType] could not be found in a [BaseService].
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DuplicateMRIDException(Exception):
|
|
22
|
+
"""
|
|
23
|
+
An exception indicating that an mRID has already been used by a different objects in a [BaseService].
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class DuplicateNameTypeException(Exception):
|
|
28
|
+
"""
|
|
29
|
+
An exception indicating that n [NameType] has already been used in a [BaseService].
|
|
30
|
+
"""
|
|
@@ -0,0 +1,169 @@
|
|
|
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__ = ["CustomerCimReader"]
|
|
7
|
+
|
|
8
|
+
from typing import Callable
|
|
9
|
+
|
|
10
|
+
from zepben.ewb.database.sqlite.common.base_cim_reader import BaseCimReader
|
|
11
|
+
from zepben.ewb.database.sqlite.extensions.result_set import ResultSet
|
|
12
|
+
from zepben.ewb.database.sqlite.tables.associations.table_customer_agreements_pricing_structures import TableCustomerAgreementsPricingStructures
|
|
13
|
+
from zepben.ewb.database.sqlite.tables.associations.table_pricing_structures_tariffs import TablePricingStructuresTariffs
|
|
14
|
+
from zepben.ewb.database.sqlite.tables.iec61968.common.table_agreements import TableAgreements
|
|
15
|
+
from zepben.ewb.database.sqlite.tables.iec61968.customers.table_customer_agreements import TableCustomerAgreements
|
|
16
|
+
from zepben.ewb.database.sqlite.tables.iec61968.customers.table_customers import TableCustomers
|
|
17
|
+
from zepben.ewb.database.sqlite.tables.iec61968.customers.table_pricing_structures import TablePricingStructures
|
|
18
|
+
from zepben.ewb.database.sqlite.tables.iec61968.customers.table_tariffs import TableTariffs
|
|
19
|
+
from zepben.ewb.model.cim.iec61968.common.agreement import Agreement
|
|
20
|
+
from zepben.ewb.model.cim.iec61968.customers.customer import Customer
|
|
21
|
+
from zepben.ewb.model.cim.iec61968.customers.customer_agreement import CustomerAgreement
|
|
22
|
+
from zepben.ewb.model.cim.iec61968.customers.customer_kind import CustomerKind
|
|
23
|
+
from zepben.ewb.model.cim.iec61968.customers.pricing_structure import PricingStructure
|
|
24
|
+
from zepben.ewb.model.cim.iec61968.customers.tariff import Tariff
|
|
25
|
+
from zepben.ewb.services.customer.customers import CustomerService
|
|
26
|
+
|
|
27
|
+
class CustomerCimReader(BaseCimReader):
|
|
28
|
+
"""
|
|
29
|
+
A class for reading the `CustomerService` tables from the database.
|
|
30
|
+
|
|
31
|
+
:param service: The `CustomerService` to populate from the database.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def __init__(self, service: CustomerService):
|
|
35
|
+
super().__init__(service)
|
|
36
|
+
self._service: CustomerService
|
|
37
|
+
|
|
38
|
+
###################
|
|
39
|
+
# IEC61968 Common #
|
|
40
|
+
###################
|
|
41
|
+
|
|
42
|
+
def _load_agreement(self, agreement: Agreement, table: TableAgreements, result_set: ResultSet) -> bool:
|
|
43
|
+
return self._load_document(agreement, table, result_set)
|
|
44
|
+
|
|
45
|
+
######################
|
|
46
|
+
# IEC61968 Customers #
|
|
47
|
+
######################
|
|
48
|
+
|
|
49
|
+
def load_customers(self, table: TableCustomers, result_set: ResultSet, set_identifier: Callable[[str], str]) -> bool:
|
|
50
|
+
"""
|
|
51
|
+
Create a `Customer` and populate its fields from `TableCustomers`.
|
|
52
|
+
|
|
53
|
+
:param table: The database table to read the `Customer` fields from.
|
|
54
|
+
:param result_set: The record in the database table containing the fields for this `Customer`.
|
|
55
|
+
:param set_identifier: A callback to register the mRID of this `Customer` for logging purposes.
|
|
56
|
+
|
|
57
|
+
:return: True if the `Customer` was successfully read from the database and added to the service.
|
|
58
|
+
:raises SqlException: For any errors encountered reading from the database.
|
|
59
|
+
"""
|
|
60
|
+
customer = Customer(mrid=set_identifier(result_set.get_string(table.mrid.query_index)))
|
|
61
|
+
|
|
62
|
+
customer.kind = CustomerKind[result_set.get_string(table.kind.query_index)]
|
|
63
|
+
# Currently unused customer.num_end_devices = rs.get_int(table.num_end_devices.query_index, None)
|
|
64
|
+
customer.special_need = result_set.get_string(table.special_need.query_index, on_none=None)
|
|
65
|
+
|
|
66
|
+
return self._load_organisation_role(customer, table, result_set) and self._add_or_throw(customer)
|
|
67
|
+
|
|
68
|
+
def load_customer_agreements(self, table: TableCustomerAgreements, result_set: ResultSet, set_identifier: Callable[[str], str]) -> bool:
|
|
69
|
+
"""
|
|
70
|
+
Create a `CustomerAgreement` and populate its fields from `TableCustomerAgreements`.
|
|
71
|
+
|
|
72
|
+
:param table: The database table to read the `CustomerAgreement` fields from.
|
|
73
|
+
:param result_set: The record in the database table containing the fields for this `CustomerAgreement`.
|
|
74
|
+
:param set_identifier: A callback to register the mRID of this `CustomerAgreement` for logging purposes.
|
|
75
|
+
|
|
76
|
+
:return: True if the `CustomerAgreement` was successfully read from the database and added to the service.
|
|
77
|
+
:raises SqlException: For any errors encountered reading from the database.
|
|
78
|
+
"""
|
|
79
|
+
customer_agreement = CustomerAgreement(mrid=set_identifier(result_set.get_string(table.mrid.query_index)))
|
|
80
|
+
|
|
81
|
+
customer_agreement.customer = self._ensure_get(
|
|
82
|
+
result_set.get_string(table.customer_mrid.query_index, on_none=None),
|
|
83
|
+
Customer
|
|
84
|
+
)
|
|
85
|
+
if customer_agreement.customer is not None:
|
|
86
|
+
customer_agreement.customer.add_agreement(customer_agreement)
|
|
87
|
+
|
|
88
|
+
return self._load_agreement(customer_agreement, table, result_set) and self._add_or_throw(customer_agreement)
|
|
89
|
+
|
|
90
|
+
def load_pricing_structures(self, table: TablePricingStructures, result_set: ResultSet, set_identifier: Callable[[str], str]) -> bool:
|
|
91
|
+
"""
|
|
92
|
+
Create a `PricingStructure` and populate its fields from `TablePricingStructures`.
|
|
93
|
+
|
|
94
|
+
:param table: The database table to read the `PricingStructure` fields from.
|
|
95
|
+
:param result_set: The record in the database table containing the fields for this `PricingStructure`.
|
|
96
|
+
:param set_identifier: A callback to register the mRID of this `PricingStructure` for logging purposes.
|
|
97
|
+
|
|
98
|
+
:return: True if the `PricingStructure` was successfully read from the database and added to the service.
|
|
99
|
+
:raises SqlException: For any errors encountered reading from the database.
|
|
100
|
+
"""
|
|
101
|
+
pricing_structure = PricingStructure(mrid=set_identifier(result_set.get_string(table.mrid.query_index)))
|
|
102
|
+
|
|
103
|
+
return self._load_document(pricing_structure, table, result_set) and self._add_or_throw(pricing_structure)
|
|
104
|
+
|
|
105
|
+
def load_tariffs(self, table: TableTariffs, result_set: ResultSet, set_identifier: Callable[[str], str]) -> bool:
|
|
106
|
+
"""
|
|
107
|
+
Create a `Tariff` and populate its fields from `TableTariffs`.
|
|
108
|
+
|
|
109
|
+
:param table: The database table to read the `Tariff` fields from.
|
|
110
|
+
:param result_set: The record in the database table containing the fields for this `Tariff`.
|
|
111
|
+
:param set_identifier: A callback to register the mRID of this `Tariff` for logging purposes.
|
|
112
|
+
|
|
113
|
+
:return: True if the `Tariff` was successfully read from the database and added to the service.
|
|
114
|
+
:raises SqlException: For any errors encountered reading from the database.
|
|
115
|
+
"""
|
|
116
|
+
tariff = Tariff(mrid=set_identifier(result_set.get_string(table.mrid.query_index)))
|
|
117
|
+
|
|
118
|
+
return self._load_document(tariff, table, result_set) and self._add_or_throw(tariff)
|
|
119
|
+
|
|
120
|
+
################
|
|
121
|
+
# Associations #
|
|
122
|
+
################
|
|
123
|
+
|
|
124
|
+
def load_customer_agreements_pricing_structures(self, table: TableCustomerAgreementsPricingStructures, result_set: ResultSet, set_identifier: Callable[[str], str]) -> bool:
|
|
125
|
+
"""
|
|
126
|
+
Create a `CustomerAgreement` to `PricingStructure` association from `TableCustomerAgreementsPricingStructures`.
|
|
127
|
+
|
|
128
|
+
:param table: The database table to read the association from.
|
|
129
|
+
:param result_set: The record in the database table containing the fields for this association.
|
|
130
|
+
:param set_identifier: A callback to register the identifier of this association for logging purposes.
|
|
131
|
+
|
|
132
|
+
:return: True if the association was successfully read from the database and added to the service.
|
|
133
|
+
:raises SqlException: For any errors encountered reading from the database.
|
|
134
|
+
"""
|
|
135
|
+
customer_agreement_mrid = set_identifier(result_set.get_string(table.customer_agreement_mrid.query_index))
|
|
136
|
+
set_identifier(f"{customer_agreement_mrid}-to-UNKNOWN")
|
|
137
|
+
|
|
138
|
+
pricing_structure_mrid = result_set.get_string(table.pricing_structure_mrid.query_index)
|
|
139
|
+
set_identifier(f"{customer_agreement_mrid}-to-{pricing_structure_mrid}")
|
|
140
|
+
|
|
141
|
+
customer_agreement = self._ensure_get(customer_agreement_mrid, CustomerAgreement)
|
|
142
|
+
pricing_structure = self._ensure_get(pricing_structure_mrid, PricingStructure)
|
|
143
|
+
|
|
144
|
+
customer_agreement.add_pricing_structure(pricing_structure)
|
|
145
|
+
|
|
146
|
+
return True
|
|
147
|
+
|
|
148
|
+
def load_pricing_structures_tariffs(self, table: TablePricingStructuresTariffs, result_set: ResultSet, set_identifier: Callable[[str], str]) -> bool:
|
|
149
|
+
"""
|
|
150
|
+
Create a `PricingStructure` to `Tariff` association from `TablePricingStructuresTariffs`.
|
|
151
|
+
|
|
152
|
+
:param table: The database table to read the association from.
|
|
153
|
+
:param result_set: The record in the database table containing the fields for this association.
|
|
154
|
+
:param set_identifier: A callback to register the identifier of this association for logging purposes.
|
|
155
|
+
|
|
156
|
+
:return: True if the association was successfully read from the database and added to the service.
|
|
157
|
+
:raises SqlException: For any errors encountered reading from the database.
|
|
158
|
+
"""
|
|
159
|
+
pricing_structure_mrid = set_identifier(result_set.get_string(table.pricing_structure_mrid.query_index))
|
|
160
|
+
set_identifier(f"{pricing_structure_mrid}-to-UNKNOWN")
|
|
161
|
+
|
|
162
|
+
tariff_mrid = result_set.get_string(table.tariff_mrid.query_index)
|
|
163
|
+
|
|
164
|
+
pricing_structure = self._ensure_get(pricing_structure_mrid, PricingStructure)
|
|
165
|
+
tariff = self._ensure_get(tariff_mrid, Tariff)
|
|
166
|
+
|
|
167
|
+
pricing_structure.add_tariff(tariff)
|
|
168
|
+
|
|
169
|
+
return True
|
|
@@ -0,0 +1,137 @@
|
|
|
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__ = ["CustomerCimWriter"]
|
|
7
|
+
|
|
8
|
+
from zepben.ewb.database.sqlite.common.base_cim_writer import BaseCimWriter
|
|
9
|
+
from zepben.ewb.database.sqlite.customer.customer_database_tables import CustomerDatabaseTables
|
|
10
|
+
from zepben.ewb.database.sqlite.extensions.prepared_statement import PreparedStatement
|
|
11
|
+
from zepben.ewb.database.sqlite.tables.associations.table_customer_agreements_pricing_structures import TableCustomerAgreementsPricingStructures
|
|
12
|
+
from zepben.ewb.database.sqlite.tables.associations.table_pricing_structures_tariffs import TablePricingStructuresTariffs
|
|
13
|
+
from zepben.ewb.database.sqlite.tables.iec61968.common.table_agreements import TableAgreements
|
|
14
|
+
from zepben.ewb.database.sqlite.tables.iec61968.customers.table_customer_agreements import TableCustomerAgreements
|
|
15
|
+
from zepben.ewb.database.sqlite.tables.iec61968.customers.table_customers import TableCustomers
|
|
16
|
+
from zepben.ewb.database.sqlite.tables.iec61968.customers.table_pricing_structures import TablePricingStructures
|
|
17
|
+
from zepben.ewb.database.sqlite.tables.iec61968.customers.table_tariffs import TableTariffs
|
|
18
|
+
from zepben.ewb.model.cim.iec61968.common.agreement import Agreement
|
|
19
|
+
from zepben.ewb.model.cim.iec61968.customers.customer import Customer
|
|
20
|
+
from zepben.ewb.model.cim.iec61968.customers.customer_agreement import CustomerAgreement
|
|
21
|
+
from zepben.ewb.model.cim.iec61968.customers.pricing_structure import PricingStructure
|
|
22
|
+
from zepben.ewb.model.cim.iec61968.customers.tariff import Tariff
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CustomerCimWriter(BaseCimWriter):
|
|
26
|
+
"""
|
|
27
|
+
A class for writing the `CustomerService` tables to the database.
|
|
28
|
+
|
|
29
|
+
:param database_tables: The tables available in the database.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def __init__(self, database_tables: CustomerDatabaseTables):
|
|
33
|
+
super().__init__(database_tables)
|
|
34
|
+
self._database_tables: CustomerDatabaseTables
|
|
35
|
+
|
|
36
|
+
###################
|
|
37
|
+
# IEC61968 Common #
|
|
38
|
+
###################
|
|
39
|
+
|
|
40
|
+
def _save_agreement(self, table: TableAgreements, insert: PreparedStatement, agreement: Agreement, description: str) -> bool:
|
|
41
|
+
return self._save_document(table, insert, agreement, description)
|
|
42
|
+
|
|
43
|
+
######################
|
|
44
|
+
# IEC61968 Customers #
|
|
45
|
+
######################
|
|
46
|
+
|
|
47
|
+
def save_customer(self, customer: Customer) -> bool:
|
|
48
|
+
"""
|
|
49
|
+
Save the `Customer` fields to `TableCustomers`.
|
|
50
|
+
|
|
51
|
+
:param customer: The `Customer` instance to write to the database.
|
|
52
|
+
|
|
53
|
+
:return: True if the `Customer` was successfully written to the database, otherwise False.
|
|
54
|
+
:raises SQLException: For any errors encountered writing to the database.
|
|
55
|
+
"""
|
|
56
|
+
table = self._database_tables.get_table(TableCustomers)
|
|
57
|
+
insert = self._database_tables.get_insert(TableCustomers)
|
|
58
|
+
|
|
59
|
+
insert.add_value(table.kind.query_index, customer.kind.name)
|
|
60
|
+
insert.add_value(table.num_end_devices.query_index, 0) # Currently unused
|
|
61
|
+
insert.add_value(table.special_need.query_index, customer.special_need)
|
|
62
|
+
|
|
63
|
+
return self._save_organisation_role(table, insert, customer, "customer")
|
|
64
|
+
|
|
65
|
+
def save_customer_agreement(self, customer_agreement: CustomerAgreement) -> bool:
|
|
66
|
+
"""
|
|
67
|
+
Save the `CustomerAgreement` fields to `TableCustomerAgreements`.
|
|
68
|
+
|
|
69
|
+
:param customer_agreement: The `CustomerAgreement` instance to write to the database.
|
|
70
|
+
|
|
71
|
+
:return: True if the `CustomerAgreement` was successfully written to the database, otherwise False.
|
|
72
|
+
:raises SQLException: For any errors encountered writing to the database.
|
|
73
|
+
"""
|
|
74
|
+
table = self._database_tables.get_table(TableCustomerAgreements)
|
|
75
|
+
insert = self._database_tables.get_insert(TableCustomerAgreements)
|
|
76
|
+
|
|
77
|
+
status = True
|
|
78
|
+
for it in customer_agreement.pricing_structures:
|
|
79
|
+
status = all([status, self._save_customer_agreement_to_pricing_structure_association(customer_agreement, it)])
|
|
80
|
+
|
|
81
|
+
insert.add_value(table.customer_mrid.query_index, self._mrid_or_none(customer_agreement.customer))
|
|
82
|
+
|
|
83
|
+
return all([status, self._save_agreement(table, insert, customer_agreement, "customer agreement")])
|
|
84
|
+
|
|
85
|
+
def save_pricing_structure(self, pricing_structure: PricingStructure) -> bool:
|
|
86
|
+
"""
|
|
87
|
+
Save the `PricingStructure` fields to `TablePricingStructures`.
|
|
88
|
+
|
|
89
|
+
:param pricing_structure: The `PricingStructure` instance to write to the database.
|
|
90
|
+
|
|
91
|
+
:return: True if the `PricingStructure` was successfully written to the database, otherwise False.
|
|
92
|
+
:raises SQLException: For any errors encountered writing to the database.
|
|
93
|
+
"""
|
|
94
|
+
table = self._database_tables.get_table(TablePricingStructures)
|
|
95
|
+
insert = self._database_tables.get_insert(TablePricingStructures)
|
|
96
|
+
|
|
97
|
+
status = True
|
|
98
|
+
for it in pricing_structure.tariffs:
|
|
99
|
+
status = all([status, self._save_pricing_structure_to_tariff_association(pricing_structure, it)])
|
|
100
|
+
|
|
101
|
+
return all([status, self._save_document(table, insert, pricing_structure, "pricing structure")])
|
|
102
|
+
|
|
103
|
+
def save_tariff(self, tariff: Tariff) -> bool:
|
|
104
|
+
"""
|
|
105
|
+
Save the `Tariff` fields to `TableTariffs`.
|
|
106
|
+
|
|
107
|
+
:param tariff: The `Tariff` instance to write to the database.
|
|
108
|
+
|
|
109
|
+
:return: True if the `Tariff` was successfully written to the database, otherwise False.
|
|
110
|
+
:raises SQLException: For any errors encountered writing to the database.
|
|
111
|
+
"""
|
|
112
|
+
table = self._database_tables.get_table(TableTariffs)
|
|
113
|
+
insert = self._database_tables.get_insert(TableTariffs)
|
|
114
|
+
|
|
115
|
+
return self._save_document(table, insert, tariff, "tariff")
|
|
116
|
+
|
|
117
|
+
################
|
|
118
|
+
# Associations #
|
|
119
|
+
################
|
|
120
|
+
|
|
121
|
+
def _save_customer_agreement_to_pricing_structure_association(self, customer_agreement: CustomerAgreement, pricing_structure: PricingStructure) -> bool:
|
|
122
|
+
table = self._database_tables.get_table(TableCustomerAgreementsPricingStructures)
|
|
123
|
+
insert = self._database_tables.get_insert(TableCustomerAgreementsPricingStructures)
|
|
124
|
+
|
|
125
|
+
insert.add_value(table.customer_agreement_mrid.query_index, customer_agreement.mrid)
|
|
126
|
+
insert.add_value(table.pricing_structure_mrid.query_index, pricing_structure.mrid)
|
|
127
|
+
|
|
128
|
+
return self._try_execute_single_update(insert, "customer agreement to pricing structure association")
|
|
129
|
+
|
|
130
|
+
def _save_pricing_structure_to_tariff_association(self, pricing_structure: PricingStructure, tariff: Tariff) -> bool:
|
|
131
|
+
table = self._database_tables.get_table(TablePricingStructuresTariffs)
|
|
132
|
+
insert = self._database_tables.get_insert(TablePricingStructuresTariffs)
|
|
133
|
+
|
|
134
|
+
insert.add_value(table.pricing_structure_mrid.query_index, pricing_structure.mrid)
|
|
135
|
+
insert.add_value(table.tariff_mrid.query_index, tariff.mrid)
|
|
136
|
+
|
|
137
|
+
return self._try_execute_single_update(insert, "pricing structure to tariff association")
|