Releases: zepben/ewb-sdk-python
Releases · zepben/ewb-sdk-python
v1.3.1
v1.3.0
Breaking Changes
- Updated
SetDirectionto correctly use the@singledispatchmethodregistrationruninstead of the oldrun_terminal. Simply replace yourrun_terminal
call withrun. EquipmentTreeBuilder.rootsis now adictkeyed by thestart_itemrather than aGenerator. This allows better lookup of root items when you are looking
for an explicit items tree.- Renamed
PanDemandResponseFunctionconstructor argumentappliances->applianceto match the class property. - Deprecated the following side-hustle shadowy names for
PowerSystemResource.asset_info, just useasset_infodirectly:Conductor.wire_infoCurrentTransformer.current_transformer_infoPotentialTransformer.potential_transformer_infoPowerTransformer.power_transformer_infoProtectionRelayFunction.relay_infoShuntCompensator.shunt_compensator_infoSwitch.switch_info
- The
ShuntCompensator.groundingTerminalmust now:- Belong to the
ShuntCompensator. Assigning aTerminaltoShuntCompensator.groundingTerminalwill now set the terminalsconductingEquipmentto the
ShuntCompensatorif it isn't set, and throw anIllegalArgumentExceptionif it is assigned to a differentConductingEquipment. - Be in the
ShuntCompensator.terminalscollection, and will be added automatically if it is missing on assignment, which in turn will update the
sequenceNumberof theTerminalif it is0. - Have phases
N.
- Belong to the
- Phase paths through a
ShuntCompensatornow add paths for mismatched phases between the grounding and normal terminals. This works in the same way as the
PowerTransformer. This will only impact traces that are tracking the included phase paths, and will allow traces that previously stopped at the
ShuntCompensatorto continue. You should use the newstopOnShuntCompensatorGroundcondition to maintain current behaviour. NameTypeandNamenow require constructor args to be supplied as kwargs only.GrpcClientnow requires astubto be passed into its constructor as a kw only arg.BaseServicefunctions__contains__,get,addandremovehave replaced theiridentified_objectparameters with
identifiable: Identifiable.BaseServicemembers and functions that used to referenceIdentifiedObjectnow useIdentifiableinstead.MultiObjectResult.objectsis now adict[str, Identifiable]. This will cause problems if you are explicitly expecting anIdentifiedObjectto be
returned via a consumer client call without any further type narrowing.- Private function
CimConsumerClient.extract_identified_objectshas been renamed toextract_identifiables. ReferenceDifferencememberssourceandtarget_valuenow referenceIdentifiable.- Renamed the following gRPC messages and attributes to support identifiable objects that don't descend from
IdentifiedObject(such asDataSet):- In the
ccprotos:CustomerConsumer.getIdentifiedObjects->CustomerConsumer.getIdentifiablesGetIdentifiedObjectsRequest->GetIdentifiablesRequestGetIdentifiedObjectsResponse->GetIdentifiablesResponseGetIdentifiablesResponse.identified_objects->GetIdentifiablesResponse.identifiablesCustomerIdentifiedObject->CustomerIdentifiableCustomerIdentifiable.identified_object->CustomerIdentifiable.identifiableGetCustomersForContainerResponse.identified_object->GetCustomersForContainerResponse.identifiable
- In the
dcprotos:DiagramConsumer.getIdentifiedObjects->DiagramConsumer.getIdentifiablesGetIdentifiedObjectsRequest->GetIdentifiablesRequestGetIdentifiedObjectsResponse->GetIdentifiablesResponseGetIdentifiablesResponse.identified_objects->GetIdentifiablesResponse.identifiablesDiagramIdentifiedObject->DiagramIdentifiableDiagramIdentifiable.identified_object->DiagramIdentifiable.identifiableGetDiagramObjectsResponse.identified_object->GetDiagramObjectsResponse.identifiable
- In the
ncprotos:NetworkConsumer.getIdentifiedObjects->NetworkConsumer.getIdentifiablesGetIdentifiedObjectsRequest->GetIdentifiablesRequestGetIdentifiedObjectsResponse->GetIdentifiablesResponseGetIdentifiablesResponse.identified_objects->GetIdentifiablesResponse.identifiablesNetworkIdentifiedObject->NetworkIdentifiableNetworkIdentifiable.identified_object->NetworkIdentifiable.identifiableGetEquipmentForContainersResponse.identified_object->GetEquipmentForContainersResponse.identifiableGetEquipmentForRestrictionResponse.identified_object->GetEquipmentForRestrictionResponse.identifiable
- In the
New Features
- Added
Conditions.stopOnShuntCompensatorGround, a new condition to prevent tracing through aShuntCompensatorusing its grounding terminal. - Added
Identifiableinterface which definesmrid. - Anything implementing
Identifiablecan now be added to aBaseService. NameTypeandNamenow implementIdentifiable. Their mRID will be set to<name>and<name>-<type.name>-<identified_object.mrid>.- Promoted
BaseServiceReader,BaseServiceWriter,BaseCimReader,BaseCollectionReader,BaseCollectionWriter, andBaseServiceReaderto the public API. - Added
customerIdentifiableto replacecustomer_identified_objectwith support forIdentifiableobject types in the future. - Added
diagramIdentifiableto replacediagram_identified_objectwith support forIdentifiableobject types in the future. - Added
networkIdentifiableto replacenetwork_identified_objectwith support forIdentifiableobject types in the future. - Added the following functions to all
CimConsumerClientdescendants:get_identifiablewhich replaces the now deprecatedget_identified_object.get_identifiableswhich replaces the now deprecatedget_identified_objects.
Enhancements
- Added sequence unpacking support for
UnresolvedReferenceandObjectDifference. SetDirection.runnow supportsConductingEquipment.- Fixed types on all overrides for
PowerSystemResource.asset_info, removing the need to shadow them with type specific variants. - You can now pass a list of
TransformerEndRatedSto thePowerTransformerEndconstructor via theratingsargument. - Updated all
Callabletype signatures for callables with unused return values to acceptAnyinstead ofNone. The return is still unused, but requiring
Noneraises types errors if anything is actually returned. IdentifiedObject,NameandNameTypenow extendsIdentifiable.BaseServiceComparatorwill now compare allIdentifiableobjects that have been added, not justIdentifiedObjectobjects.
Fixes
- Fixed the packing and unpacking of timestamps for
Agreement.validity_intervalin gRPC messages. Fix also ensures all other timestamps correctly support
Nonewhen optional. - Fixed an error in
PhaseCodewhen addingNONEwhich previously resulted inNONEinstead of the existingPhaseCode. BaseService.__contains__`` will now returnfalsewhen passed anIdentifiablethat is not in the service, instead of raising aKeyError`- Clearing the names from an
IdentifiedObjectwith no names no longer raises aTypeError.
Notes
- Deprecated the
customer_identified_objectfunction, please use the replacementcustomer_identifiable. - Deprecated the
diagram_identified_objectfunction, please use the replacementdiagram_identifiable. - Deprecated the
network_identified_objectfunction, please use the replacementnetwork_identifiable. - Deprecated the following functions on all
CimConsumerClientdescendants:get_identified_objectwhich has been replaced withget_identifiable.get_identified_objectswhich has been replaced withget_identifiables.
v1.2.0
Breaking Changes
- The following gRPC fields have been modified to support nulls (they were missed in v1.0.0):
Document.created_date_timeEquipment.commissioned_dateMeasurementValue.time_stampRelayInfo.curve_settingRelayInfo.reclose_fast
- Removed
TracedPhases.Terminal.normalPhasesandTerminal.currentPhasesshould be used instead ofTerminal.tracedPhasesgoing forward. (missed in 0.48.0)
New Features
- Added the following new CIM classes:
DateTimeInterval, interval between two date and time points, where the interval includes the start time but excludes end time.ElectronicAddress, electronic address information.TelephoneNumber, telephone number.HvCustomer- [ZBEX] anEquipmentContainerfor high voltage customer assets.LvSubstation- [ZBEX] anEquipmentContainerto represent distribution transformer sites, with associations toFeederandLvFeederAcLineSegmentPhase- Details about an individual phase of anAcLineSegment.
- Added the following new CIM extension classes:
ContactDetails, the details required to contact a person or company. These can be accessed/used via aUsagePoint.DirectionalCurrentRelay, a directional current relay is a type of protective relay used in electrical power systems to detect the direction of current
flow and operate only when the current exceeds a certain threshold in a specified direction.
- Added new CIM extension enums:
ContactMethodTypePolarizingQuantityType
- Added new properties to the model:
PricingStructure.code- User allocated key for a pricing structure.ShuntCompensator.grounding_terminal- [ZBEX] The terminal connecting to grounded network.WireInfo- extra properties for conductors:size_descriptionstrand_countcore_strand_countinsulatedinsulation_materialinsulation_thickness
- Added new enum
WireInsulationKindwith extensions. - Added helper function
AcLineSegment.wire_info_for_phase()for retrieving theWireInfofor a given phase of a conductor. - Added helper function
EquipmentContainer.edge_terminals()for retrieving all terminals on the edge of anEquipmentContainer. - Added support to filter NetworkHierarchy responses when calling
NetworkConsumerClient.get_network_hierarchy(). A client can now choose what hierarchy
containers should be populated in the response. - Added
AcLineSegment.wire_info_for_phase(phase: SinglePhaseKind)to retrieve theWireInfoassociated with a given phase of a conductor.
Enhancements
-
BaseService.containshas been been expanded to support objects in addition to mRIDs.
Agreementnow supportsvalidity_interval, the date and time interval the agreement is valid (from going into effect to termination).StreetDetailnow supports extensionbuilding_number, the number of the building.TownDetailnow supportscountry, the name of the country.ngen()now directly acceptsdict()s and will return a generator of thevalues()orNoneifcollection is None
Fixes
- Reordered the feeder equipment and direction assignment on database read to prevent parallel feeders from tracing back into the zone substation.
NetworkDatabaseTables,CustomerDatabaseTables,DiagramDatabaseTablesandBaseEntryWritercan now be imported fromzepben.ewband are officially
regarded as public.
Notes
- None.
v1.1.0
Breaking Changes
- Updated
EwbDataFilePathsto be an abstract class that supports variants. AddedLocalEwbDataFilePathswhich is a local file system implementation of
EwbDataFilePaths, and should be used in place of the oldEwbDataFilePaths. CopyableUUIDhas been removed, and replaced with a newgenerate_idfunction.- All
IdentifiedObjectclasses now require anmridto be passed to the constructor, it will no longer be generated by default. This brings the Python SDK
into alignment with the JVM SDK. You can use the newgenerate_idfunction if you can't provide a more meaningful mRID.
New Features
- None.
Enhancements
- Bumped
hypothesisversion for tests to latest (6.138.2), fixed examples generating large numbers of results causing tests to run extremely slow. - Bumped every other dependency to the latest version aside from dataclassy.
- You can now opt out of the post read processing in the database readers using the optional
preform_after_read_processingparameter.
Fixes
- Moved ZepbenTokenAuth to use python dataclasses instead of
zepben.ewb.dataclassy, existing code should work as is. TypeErrors occurring inStepActions will no longer silently pass- Drop python 3.9 from list of test envs in tox
- Fix an ImportError being raised when calling
Conductor.is_underground()
Notes
- None.
v1.0.4
Breaking Changes
- None.
New Features
- None.
Enhancements
- None.
Fixes
- Fix an ImportError being raised when calling
Conductor.is_underground() TypeErrors occurring inStepActions will no longer silently pass
Notes
- None.
v1.0.3
Fixes
- Moved ZepbenTokenAuth to use python dataclasses instead of
zepben.ewb.dataclassy, existing code should work as is.
v1.0.0
Breaking Changes
- Removed support for Python 3.9. Upgrade your Python environment to at least 3.10.
- Renamed the package to
zepben.ewb. You will need to update all your importszepben.evolve.*->zepben.ewb.*. This also updates the pypi artifact to
zepben.ewb. - Renamed
length_from_t1_or_0tolength_from_t1_or_0. - Relocated the following classes into the Zepben extensions area, marking them as [ZBEX]:
DistanceRelay:cim.iec61970.base.protection->cim.extensions.iec61970.base.protection.EvChargingUnit:cim.iec61970.infiec61970.wires.generation.production->cim.extensions.iec61970.base.generation.production.Loop:cim.iec61970.infiec61970.feeder->cim.extensions.iec61970.base.feeder.LvFeeder:cim.iec61970.infiec61970.feeder->cim.extensions.iec61970.base.feeder.PowerDirectionKind:cim.iec61970.infiec61970.protection->cim.extensions.iec61970.base.protection.ProtectionKind:cim.iec61970.infiec61970.protection->cim.extensions.iec61970.base.protection.ProtectionRelayFunction:cim.iec61970.base.protection->cim.extensions.iec61970.base.protection.ProtectionRelayScheme:cim.iec61970.base.protection->cim.extensions.iec61970.base.protection.ProtectionRelaySystem:cim.iec61970.base.protection->cim.extensions.iec61970.base.protection.RelayInfo:cim.iec61968.infiec61968.infassetinfo->cim.extensions.iec61968.assetinfo.RelaySetting:cim.iec61970.base.protection->cim.extensions.iec61970.base.protection.Site:cim.iec61970.base.core->cim.extensions.iec61970.base.core.TransformerCoolingType:cim.iec61970.base.wires->cim.extensions.iec61970.base.wires.TransformerEndRatedS:cim.iec61970.base.wires->cim.extensions.iec61970.base.wires.VectorGroup:cim.iec61970.base.wires->cim.extensions.iec61970.base.wires.VoltageRelay:cim.iec61970.base.protection->cim.extensions.iec61970.base.protection.WindingConnection:cim.iec61970.base.wires.winding->cim.iec61970.base.wires.
- Relocated the following classes that were in the wrong packages:
Pole:cim.iec61968.assets->cim.iec61968.infiec61968.infassets.StreetlightLampKind:cim.iec61968.assets->cim.iec61968.infiec61968.infassets.- All classes in the incorrectly located
cim.iec61970.base.wires.generation.production->cim.iec61970.base.generation.production.
- The protobuf implementation has the following changes, which will only have an impact if you are using protobuf directly:
- Updated the values of the following enums to conform to Protobuf standard naming:
BatteryControlModeBatteryStateKindCustomerKindDiagramStyleEndDeviceFunctionKindFeederDirectionIncludedEnergizedContainersIncludedEnergizingContainersLogLevelLogSourceNetworkStateOrientationKindPhaseCodePhaseShuntConnectionKindPotentialTransformerKindPowerDirectionKindProtectionKindRegulatingControlModeKindSinglePhaseKindStreetlightLampKindSVCControlModeSwitchActionSynchronousMachineKindTransformerConstructionKindTransformerCoolingTypeTransformerFunctionKindUnitSymbolVectorGroupWindingConnectionWireMaterialKind
- Renumbered the protobuf fields for:
AcLineSegmentControlDiagramTransformerEnd
- Updated the values of the following enums to conform to Protobuf standard naming:
- Renamed the following enum values:
PowerDirectionKind.UNKNOWN_DIRECTION->PowerDirectionKind.UNKNOWNRegulatingControlModeKind.UNKNOWN_CONTROL_MODE->RegulatingControlModeKind.UNKNOWNTransformerCoolingType.UNKNOWN_COOLING_TYPE->TransformerCoolingType.UNKNOWNWindingConnection.UNKNOWN_WINDING->WindingConnection.UNKNOWN
- Added
TransformerFunctionKind.UNKNOWNto allow distinction between an unknown function, and a function that is not covered by the enum (i.e.other). This
addition has changed the order of the enum values, withothernow being the last entry, instead of the first. NetworkConsumerClientandSyncNetworkConsumerClientno longer use the protobufIncludedEnergizedContainers,IncludedEnergizingContainersand
NetworkStateenums directly, it now uses SDK versions of these enums. To use these enums you will need to update your imports, and use the simplified
versions of the enum values:IncludedEnergizedContainersfrom packagezepben.ewb.streaming.get.EXCLUDE_ENERGIZED_CONTAINERS->NONE.INCLUDE_ENERGIZED_FEEDERS->FEEDERS.INCLUDE_ENERGIZED_LV_FEEDERS->LV_FEEDERS.
IncludedEnergizingContainersfrom packagezepben.ewb.streaming.get.EXCLUDE_ENERGIZING_CONTAINERS->NONE.INCLUDE_ENERGIZING_FEEDERS->FEEDERS.INCLUDE_ENERGIZING_SUBSTATIONS->SUBSTATIONS.
NetworkStatefrom packagezepben.ewb.services.network.ALL_NETWORK_STATE->ALL.NORMAL_NETWORK_STATE->NORMAL.CURRENT_NETWORK_STATE->CURRENT.
- The
zepben.authdependency has been incorporated into the SDK with the following package change:zepben.auth->zepben.ewb.auth. You can also import these directly fromzepben.ewb.
SqliteTablenow subclassesSqlTable.- The following CIM fields have been made nullable. Note if previously accessing these fields you will now have to handle them potentially being null.
Analog.positiveFlowInDocument.*EnergyConsumer.groundedEnergySource.isExternalGridIdentifiedObject.nameIdentifiedObject.descriptionIdentifiedObject.numDiagramObjectsMeter.companyMeterIdNameType.descriptionPole.classificationPowerSystemResource.numControlsRegulatingCondEq.controlEnabledShuntCompensator.groundedStreetAddress.postalCodeStreetAddress.poBoxStreetDetail.*SynchronousMachine.earthingTapChanger.controlEnabledTransformerEnd.groundedUsagePoint.isVirtual
New Features
- Created a new
SqlTablethat doesn't support creating schema creation statements by default.
Enhancements
EquipmentTreeBuilderwill now calculateleaveswhen specified to do so.
Fixes
- Marked some extensions properties and classes with [ZBEX] that were missing them (might still be more). In addition to the ones moved into the extensions
package:PhaseCode.YPhaseCode.YNPowerElectronicsConnection.inverterStandardPowerElectronicsConnection.sustainOpOvervoltLimitPowerElectronicsConnection.stopAtOverFreqPowerElectronicsConnection.stopAtUnderFreqPowerElectronicsConnection.invVoltWattRespModePowerElectronicsConnection.invWattRespV1PowerElectronicsConnection.invWattRespV2PowerElectronicsConnection.invWattRespV3PowerElectronicsConnection.invWattRespV4PowerElectronicsConnection.invWattRespPAtV1PowerElectronicsConnection.invWattRespPAtV2PowerElectronicsConnection.invWattRespPAtV3PowerElectronicsConnection.invWattRespPAtV4PowerElectronicsConnection.invVoltVarRespModePowerElectronicsConnection.invVarRespV1PowerElectronicsConnection.invVarRespV2PowerElectronicsConnection.invVarRespV3PowerElectronicsConnection.invVarRespV4PowerElectronicsConnection.invVarRespQAtV1PowerElectronicsConnection.invVarRespQAtV2PowerElectronicsConnection.invVarRespQAtV3PowerElectronicsConnection.invVarRespQAtV4PowerElectronicsConnection.invReactivePowerModePowerElectronicsConnection.invFixReactivePowerPowerTransformerEnd.ratingsRegulatingControl.ratedCurrentSensor.relayFunctionsUsagePoint.approvedInverterCapacity
- using
EquipmentTreeBuildermore then once per interpreter will no longer cause therootsto contain more objects then it should due to_rootsbeing a
class var - Errors when initiating gRPC connections will now properly be propagated to users.
Notes
- None.
v0.48.0
Breaking Changes
- Updated to new Tracing API. All old traces will need to be re-written with the new API.
AcLineSegmentsupports adding a maximum of 2 terminals. Mid-span terminals are no longer supported and models should migrate to usingClamp.Clampsupports only adding a single terminal.FeederDirectionStateOperationshave been reworked to takeNetworkStateOperatorsas a parameter.RemoveDirectionhas been removed. It did not work reliably with dual fed networks with loops. You now need to clear direction using the newClearDirection
and reapply directions where appropriate usingSetDirection.Cutsupports adding a maximum of 2 terminals.NetworkTraceTrackernow uses asetto track visited objects, if you were using unhashable objects this will need to be addressed.- Added a new
debug_loggingandnameparameters to the constructor of the following traces. The helper functions inTracingalso have these parameters,
which defaults toNoneandnetwork_trace, meaning anyone using these wrappers will be unaffected by the change:AssignToFeedersAssignToLvFeedersClearDirectionFindSwerEquipmentPhaseInferrerRemovePhasesSetDirectionSetPhases
NetworkStateOperatorshas a new abstractdescription. If you are creating custom operators you will need to add it.StepActionwill now raise an exception ifapplyis overridden. override_applyinstead, or pass the function to__init__
New Features
- Added
ClearDirectionthat clears feeder directions. - You can now pass a logger to all
Tracingmethods andTestNetworkBuilder.buildto enable debug logging for the traces it runs. The debug logging will
include the results of all queue and stop condition checks, and each item that is stepped on.
Enhancements
- Tracing models with
CutandClampare now supported via the new tracing API. - Added support to
TestNetworkBuilderfor:with_clamp- Adds a clamp to the previously addedAcLineSegmentwith_cut- Adds a cut to the previously addedAcLineSegmentconnect_to- Connects the previously added item, rather than having to specify it again inconnect.- You can now add sites to the
TestNetworkBuilderviaaddSite. - You can now add busbar sections natively with
from_busbar_sectionandto_busbar_section - The prefix for generated mRIDs for "other" equipment can be specified with the
default_mrid_prefixargument infrom_otherandto_other.
- When processing feeder assignments, all LV feeders belonging to a dist substation site will now be considered energized when the site is energized by a
feeder. NetworkTracenow supports starting from a knownNetworkTraceStep.Path. This allows you to force a trace to start in a particular direction, or to continue
a follow-up trace from a detected stop point.Traversal.is_stopping/Traversal.is_not_stoppingnow acceptStepActionand any child classes, including those subclassingStepActionWithContextValue
Fixes
- When finding
LvFeedersin theSitewe will now excludeLvFeedersthat start with an openSwitch AssignToFeederandAssignToLvFeederwill no longer trace from start terminals that belong to open switches- The follow fixes were added to Traversal and NetworkTrace:
can_stop_on_start_itemnow works for branching traversals.- Traversal start items are added to the queue before traversal starts, so that the start items honour the queue type order.
- Stop conditions on the
NetworkTracenow are checked based on a step type, likeQueueConditiondoes, rather than by checkingcan_action_item. CutandClampare now correctly supported inSetDirectionandDirectionCondition.NetworkTracenow handles starting onCut,Clamp, andAcLineSegmentand their terminals in a explicit / sensible way.NetworkTracePathProvidernow correctly handles next paths when starting on aClampterminal.
NetworkTrace/Traversalnow correctly respectscan_stop_on_start_itemwhen providing multiple start items.AssignToFeeders/AssignToLvFeedersnow finds back-fed equipment correctlyAssignToFeedersandAssignToLvFeederswill now associatePowerElectronicUnitswith theirpowerElectronicsConnectionFeeder/LvFeeder.- Phases are now correctly assigned to the LV side of an LV2 transformer that is in parallel with a previously energised LV1 transformer.
- Added missing default network state operators (NORMAL) if you are calling
SetDirection.rundirectly.
Notes
- None.
v0.47.1
Fixes
- Only resolve PowerSystemResource -> Asset relationship in one direction when calling
get_equipment_containerto stop deadlock. - MultiObjectResult now exposes result types inheriting from IdentifiedObject to allow better type completion
v0.47.0
Fixes
- Downgrade protobuf and gRPC deps to fix SyncNetworkConsumerClient