Exemple #1
0
def get_lines(sid, bus_dict):
    """ Extract line data from the PSSE case

    Parameters
    ==========
    include_only_in_service: Bool (optional=True)
        whether to include only in service line or not

    """
    flag = IncludeStatus.NotAddStepAndNotInService.value
    ties = 3
    (from_buses, to_buses) = MonsterPssPy.abrnint(
        sid, flag=flag, ties=ties, string=['FROMNUMBER', 'TONUMBER']
    )

    line_ids = [
        name.strip() for name in MonsterPssPy.abrnchar(
            sid, flag=flag, ties=ties, string='ID'
        )[0]
    ]

    (line_length, rates, ) = MonsterPssPy.abrnreal(
        sid, flag=flag, ties=ties, string=['LENGTH', RATE_NAME]
    )

    rxes = MonsterPssPy.abrncplx(
        sid, flag=flag, ties=ties, string='RX'
    )

    line_dict = dict()
    for from_bus, to_bus, line_id, length, rate_c, rx in zip(
            from_buses, to_buses, line_ids, line_length, rates, rxes[0]
    ):
        comp_func = _classify_branch(from_bus, to_bus, line_id)
        line = comp_func(
            from_bus=bus_dict[from_bus].from_bus,
            to_bus=bus_dict[to_bus].from_bus,
            identificator=line_id,
            length=length,
            rate_c=rate_c,
            rx=rx,
        )
        if not (line.from_bus.dummy or line.to_bus.dummy):
            line_dict[line.get_sorted_short_tuple()] = line
    return line_dict
Exemple #2
0
def get_two_winding_transformers(sid, bus_dict):
    """ Extract two winding transformer data from the PSSE case

    Parameters
    ==========
    include_only_in_service: Bool (optional=True)
        whether to include only in service line or not

    """
    flag = IncludeStatus.NotAddStepAndNotInService.value + 4
    ties = 3
    (from_buses, to_buses) = MonsterPssPy.abrnint(
        sid, flag=flag, ties=ties, string=['FROMNUMBER', 'TONUMBER']
    )
    two_winding_transformer_id = [
        name.strip() for name in MonsterPssPy.abrnchar(
            sid, flag=flag, ties=ties, string='ID'
        )[0]
    ]
    rxes = MonsterPssPy.atrncplx(
        sid, ties=ties, flag=2, string='RXACT'
    )

    two_winding_transformer_dict = dict()
    for from_bus, to_bus, two_winding_transformer_id, rx in zip(
            from_buses, to_buses, two_winding_transformer_id, rxes[0]
    ):
        two_winding_transformer = component.TwoWindingTransformer(
            from_bus=bus_dict[from_bus].from_bus,
            to_bus=bus_dict[to_bus].from_bus,
            identificator=two_winding_transformer_id,
            rx=rx
        )
        two_winding_transformer_dict[
            two_winding_transformer.get_sorted_short_tuple()
        ] = two_winding_transformer
    return two_winding_transformer_dict