Beispiel #1
0
 def runBoundaryEquivalent(self):
     #
     ARGVS.fo = AppUtils.get_file_out(fo=ARGVS.fo,
                                      fi=ARGVS.fi,
                                      subf='res',
                                      ad='_res',
                                      ext='.OLR')
     #
     opt = [ARGVS.opt1, ARGVS.opt2, ARGVS.opt3]
     OlxAPILib.BoundaryEquivalent(ARGVS.fo, list(self.busA), opt)
     #
     OlxAPI.CloseDataFile()
     if not os.path.isfile(ARGVS.fo):
         raise Exception(" Run BoundaryEquivalent")
     #
     if ARGVS.gui > 0 and ARGVS.ut == 0:
         AppUtils.launch_OneLiner(ARGVS.fo)
     print('\nOLR result file had been saved in:\n"%s"' % ARGVS.fo)
Beispiel #2
0
def run():
    """
      Check phase shift of all 2-winding transformers with wye-delta connection.
          When a transformer with high side lagging the low side is found,
          this function converts it to make the high side lead.

        Args :
            None
        Returns:
            string result
            OLR corrected file

        Raises:
            OlrxAPIException
    """
    #
    if not AppUtils.checkInputOLR(ARGVS.fi, PY_FILE, PARSER_INPUTS):
        return
    #
    OlxAPILib.open_olrFile_1(ARGVS.olxpath, ARGVS.fi, readonly=1)
    s1 = ""
    # get all xfmr
    x2a = OlxAPILib.getEquipmentHandle(TC_XFMR)
    kd = 0
    for x1 in x2a:
        configA = OlxAPILib.getEquipmentData([x1], XR_sCfg1)[0]
        configB = OlxAPILib.getEquipmentData([x1], XR_sCfg2)[0]
        tapA = OlxAPILib.getEquipmentData([x1], XR_dTap1)[0]
        tapB = OlxAPILib.getEquipmentData([x1], XR_dTap2)[0]
        #
        test = False

        # low - hight  =>  low - hight
        #   G   - D             G  - E
        if (tapA < tapB) and configA == "G" and configB == "D":
            test = True
            # set
            OlxAPILib.setData(x1, XR_sCfg2, "E")
            # validation
            OlxAPILib.postData(x1)

        # low - small  =>  low - small
        #  G    - E              G - D
        if (tapA > tapB) and configA == "G" and configB == "E":
            test = True
            # set
            OlxAPILib.setData(x1, XR_sCfg2, "D")
            # validation
            OlxAPILib.postData(x1)
        #
        if test:
            kd += 1
            s1 += '\n' + str(kd).ljust(5) + OlxAPILib.fullBranchName(x1)
    #
    if kd > 0:
        s2 = "Fixed (" + str(
            kd
        ) + ") wye-delta transformers to make the high side lead the low side:"
    else:
        s2 = "All wye-delta transformers in this OLR file have the correct phase shift of the high-side leading the low-side."
    #
    print(s2 + s1)
    #
    if kd > 0:
        ARGVS.fo = AppUtils.get_file_out(fo=ARGVS.fo,
                                         fi=ARGVS.fi,
                                         subf='',
                                         ad='_res',
                                         ext='.OLR')
        #
        OlxAPILib.saveAsOlr(ARGVS.fo)
        if ARGVS.ut == 0:
            print("The modified network had been saved as:\n" + ARGVS.fo)
            AppUtils.launch_OneLiner(ARGVS.fo)
    #
    return s2 + s1