Ejemplo n.º 1
0
def feeder_to_pb(cim: Feeder) -> PBFeeder:
    return PBFeeder(
        ec=equipmentcontainer_to_pb(cim),
        normalHeadTerminalMRID=mrid_or_empty(cim.normal_head_terminal),
        normalEnergizingSubstationMRID=mrid_or_empty(
            cim.normal_energizing_substation),
        currentEquipmentMRIDs=[str(io.mrid) for io in cim.current_equipment])
Ejemplo n.º 2
0
def terminal_to_pb(cim: Terminal) -> PBTerminal:
    return PBTerminal(
        ad=acdcterminal_to_pb(cim),
        conductingEquipmentMRID=mrid_or_empty(cim.conducting_equipment),
        connectivityNodeMRID=mrid_or_empty(cim.connectivity_node),
        tracedPhases=get_or_none(tracedphases_to_pb, cim.traced_phases),
        phases=PBPhaseCode.Value(cim.phases.short_name),
        sequenceNumber=cim.sequence_number)
Ejemplo n.º 3
0
def transformerend_to_pb(cim: TransformerEnd) -> PBTransformerEnd:
    return PBTransformerEnd(io=identifiedobject_to_pb(cim),
                            terminalMRID=mrid_or_empty(cim.terminal),
                            baseVoltageMRID=mrid_or_empty(cim.base_voltage),
                            ratioTapChangerMRID=mrid_or_empty(
                                cim.ratio_tap_changer),
                            endNumber=cim.end_number,
                            grounded=cim.grounded,
                            rGround=cim.r_ground,
                            xGround=cim.x_ground)
Ejemplo n.º 4
0
def diagramobject_to_pb(cim: DiagramObject) -> PBDiagramObject:
    return PBDiagramObject(io=identifiedobject_to_pb(cim),
                           diagramMRID=mrid_or_empty(cim.diagram),
                           identifiedObjectMRID=cim.identified_object_mrid,
                           diagramObjectStyle=PBDiagramObjectStyle.Value(cim.style.short_name),
                           rotation=cim.rotation,
                           diagramObjectPoints=[diagramobjectpoint_to_pb(io) for io in cim.points])
Ejemplo n.º 5
0
def measurement_to_pb(cim: Measurement) -> PBMeasurement:
    return PBMeasurement(
        io=identifiedobject_to_pb(cim),
        remoteSourceMRID=mrid_or_empty(cim.remote_source),
        powerSystemResourceMRID=cim.power_system_resource_mrid,
        terminalMRID=cim.terminal_mrid,
        phases=PBPhaseCode.Value(cim.phases.short_name),
        unitSymbol=PBUnitSymbol.Value(cim.unitSymbol.short_name))
Ejemplo n.º 6
0
def substation_to_pb(cim: Substation) -> PBSubstation:
    return PBSubstation(
        ec=equipmentcontainer_to_pb(cim),
        subGeographicalRegionMRID=mrid_or_empty(cim.sub_geographical_region),
        normalEnergizedFeederMRIDs=[str(io.mrid) for io in cim.feeders],
        loopMRIDs=[str(io.mrid) for io in cim.loops],
        normalEnergizedLoopMRIDs=[str(io.mrid) for io in cim.energized_loops],
        circuitMRIDs=[str(io.mrid) for io in cim.circuits])
Ejemplo n.º 7
0
def energyconsumerphase_to_pb(
        cim: EnergyConsumerPhase) -> PBEnergyConsumerPhase:
    return PBEnergyConsumerPhase(
        psr=powersystemresource_to_pb(cim),
        energyConsumerMRID=mrid_or_empty(cim.energy_consumer),
        phase=PBSinglePhaseKind.Value(cim.phase.short_name),
        p=cim.p,
        pFixed=cim.p_fixed,
        q=cim.q,
        qFixed=cim.q_fixed)
Ejemplo n.º 8
0
def powertransformerend_to_pb(
        cim: PowerTransformerEnd) -> PBPowerTransformerEnd:
    return PBPowerTransformerEnd(te=transformerend_to_pb(cim),
                                 powerTransformerMRID=mrid_or_empty(
                                     cim.power_transformer),
                                 ratedS=cim.rated_s,
                                 ratedU=cim.rated_u,
                                 r=cim.r,
                                 r0=cim.r0,
                                 x=cim.x,
                                 x0=cim.x0,
                                 connectionKind=PBWindingConnection.Value(
                                     cim.connection_kind.short_name),
                                 b=cim.b,
                                 b0=cim.b0,
                                 g=cim.g,
                                 g0=cim.g0,
                                 phaseAngleClock=cim.phase_angle_clock)
Ejemplo n.º 9
0
def customeragreement_to_pb(cim: CustomerAgreement) -> PBCustomerAgreement:
    return PBCustomerAgreement(agr=agreement_to_pb(cim),
                               customerMRID=mrid_or_empty(cim.customer),
                               pricingStructureMRIDs=[str(io.mrid) for io in cim.pricing_structures])
Ejemplo n.º 10
0
def remotesource_to_pb(cim: RemoteSource) -> PBRemoteSource:
    return PBRemoteSource(rp=remotepoint_to_pb(cim),
                          measurementMRID=mrid_or_empty(cim.measurement))
Ejemplo n.º 11
0
def remotecontrol_to_pb(cim: RemoteControl) -> PBRemoteControl:
    return PBRemoteControl(rp=remotepoint_to_pb(cim),
                           controlMRID=mrid_or_empty(cim.control))
Ejemplo n.º 12
0
def usagepoint_to_pb(cim: UsagePoint) -> PBUsagePoint:
    return PBUsagePoint(
        io=identifiedobject_to_pb(cim),
        usagePointLocationMRID=mrid_or_empty(cim.usage_point_location),
        equipmentMRIDs=[str(io.mrid) for io in cim.equipment],
        endDeviceMRIDs=[str(io.mrid) for io in cim.end_devices])
Ejemplo n.º 13
0
def control_to_pb(cim: Control) -> PBControl:
    return PBControl(ip=iopoint_to_pb(cim),
                     remoteControlMRID=mrid_or_empty(cim.remote_control),
                     powerSystemResourceMRID=cim.power_system_resource_mrid)
Ejemplo n.º 14
0
def circuit_to_pb(cim: Circuit) -> PBCircuit:
    return PBCircuit(
        l=line_to_pb(cim),
        loopMRID=mrid_or_empty(cim.loop.mrid),
        endTerminalMRIDs=[str(io.mrid) for io in cim.end_terminals],
        endSubstationMRIDs=[str(io.mrid) for io in cim.end_substations])
Ejemplo n.º 15
0
def auxiliaryequipment_to_pb(cim: AuxiliaryEquipment) -> PBAuxiliaryEquipment:
    return PBAuxiliaryEquipment(eq=equipment_to_pb(cim),
                                terminalMRID=mrid_or_empty(cim.terminal))
Ejemplo n.º 16
0
def ratiotapchanger_to_pb(cim: RatioTapChanger) -> PBRatioTapChanger:
    return PBRatioTapChanger(tc=tapchanger_to_pb(cim),
                             transformerEndMRID=mrid_or_empty(
                                 cim.transformer_end),
                             stepVoltageIncrement=cim.step_voltage_increment)
Ejemplo n.º 17
0
def energysourcephase_to_pb(cim: EnergySourcePhase) -> PBEnergySourcePhase:
    return PBEnergySourcePhase(
        psr=powersystemresource_to_pb(cim),
        energySourceMRID=mrid_or_empty(cim.energy_source),
        phase=PBSinglePhaseKind.Value(cim.phase.short_name))
Ejemplo n.º 18
0
def enddevice_to_pb(cim: EndDevice) -> PBEndDevice:
    return PBEndDevice(
        ac=assetcontainer_to_pb(cim),
        usagePointMRIDs=[str(io.mrid) for io in cim.usage_points],
        customerMRID=cim.customer_mrid,
        serviceLocationMRID=mrid_or_empty(cim.service_location))
Ejemplo n.º 19
0
def aclinesegment_to_pb(cim: AcLineSegment) -> PBAcLineSegment:
    return PBAcLineSegment(cd=conductor_to_pb(cim),
                           perLengthSequenceImpedanceMRID=mrid_or_empty(
                               cim.per_length_sequence_impedance))
Ejemplo n.º 20
0
def conductingequipment_to_pb(
        cim: ConductingEquipment) -> PBConductingEquipment:
    return PBConductingEquipment(
        eq=equipment_to_pb(cim),
        baseVoltageMRID=mrid_or_empty(cim.base_voltage),
        terminalMRIDs=[str(io.mrid) for io in cim.terminals])
Ejemplo n.º 21
0
def powersystemresource_to_pb(
        cim: PowerSystemResource) -> PBPowerSystemResource:
    return PBPowerSystemResource(io=identifiedobject_to_pb(cim),
                                 assetInfoMRID=mrid_or_empty(cim.asset_info),
                                 locationMRID=mrid_or_empty(cim.location))
Ejemplo n.º 22
0
def subgeographicalregion_to_pb(
        cim: SubGeographicalRegion) -> PBSubGeographicalRegion:
    return PBSubGeographicalRegion(
        io=identifiedobject_to_pb(cim),
        geographicalRegionMRID=mrid_or_empty(cim.geographical_region),
        substationMRIDs=[str(io.mrid) for io in cim.substations])