Example #1
0
        def __init__(self, _ACSI, _ied, File):
            self.ied = _ied
            self.ACSI = _ACSI
            self.TX = Trace.File(TL.GENERAL, "GeneratedScript\\" + File)

            self.TX.Trace(('from utest.ATL import *\n'), TL.GENERAL)
            self.TX.Trace(('from VsUtils import variables as vs\n'),
                          TL.GENERAL)
            self.TX.Trace(('from utest import IECToolkit\n'), TL.GENERAL)
            self.TX.Trace(('import time\n'), TL.GENERAL)
            self.TX.Trace(('\n'), TL.GENERAL)
            self.TX.Trace(('\n'), TL.GENERAL)

            self.TX.Trace(('class CheckDA:\n'), TL.GENERAL)
            self.TX.Trace(('\n'), TL.GENERAL)
            self.TX.Trace(('    def initialize(self):\n'), TL.GENERAL)
            self.TX.Trace(('        pass\n'), TL.GENERAL)
            self.TX.Trace(('\n'), TL.GENERAL)

            self.TX.Trace(('    def finalize(self):\n'), TL.GENERAL)
            self.TX.Trace(('        pass\n'), TL.GENERAL)
            self.TX.Trace(('\n'), TL.GENERAL)

            self.IED_ID = self.ACSI.IedName + self.ACSI.APName  # tServer[0].IEDName

            self.TX.Trace(('    def execute(self):\n'), TL.GENERAL)
            self.TX.Trace(('        ' + self.IED_ID +
                           ' = IECToolkit.Manager(' + self.ACSI.IedIP + ')\n'),
                          TL.GENERAL)
            #            IED_AP = ied.Server[0].IEDName + ied.Server[0].APName
            self.TX.Trace(
                ('        ' + 'I_' + self.IED_ID + '= ' + self.ACSI.IedName +
                 '.getACSI(' + self.IED_ID + ')\n'), TL.GENERAL)
Example #2
0
    def main(directory, file, scl):
        TRX = Trace.Console(TL.DETAIL)

        TRX.Trace(("---------------------------------------------------"),
                  TL.GENERAL)
        if scl is None:  # UNIT TEST
            scl = dom.parse(directory + file)
        TRX.Trace(("File:" + file), TL.GENERAL)
        tServices = []
        IED_lst = scl.getElementsByTagName("IED")
        for IED in IED_lst:
            _type = IED.getAttribute("type")
            _IEDname = IED.getAttribute("name")
            _desc = IED.getAttribute("desc")
            SRV = Parse_Services(_IEDname, TRX)

            TRX.Trace(
                ("IED-Name:" + _IEDname + " desc:" + _desc + " type:" + _type),
                TL.GENERAL)
            pServices = IED.firstChild.nextSibling
            while (pServices):
                if (pServices.nodeName == 'Private'):
                    pServices = pServices.nextSibling
                    continue
                if (pServices.nodeName == 'Services'):
                    tServices.append(SRV.Services(pServices))
                pServices = pServices.nextSibling
 def __init__(self, _ACSI, _ipAdrTools, _desc):
     self.ACSI = _ACSI
     self.ipAdrTools = _ipAdrTools
     self.desc = _desc
     self.T = TR.Console(TL.DETAIL)
     self.VS = TEST.CreateDictionary(self.ACSI.iedAdrMMS,
                                     self.ACSI.IedName,
                                     self.ACSI.APName)
Example #4
0
    def main(directory, file, scl):

        TX = TConsole.File(TL.GENERAL, "dump data.txt")
        TR = TConsole.Console(TL.GENERAL)
        GM = globalDataModel(TX, directory + file, scl)
        iec_BasicType = ''
        iec_TypeValue = ''
        iec_EnumType = ''

        T0_Global = time.time()
        for ied in GM.tIED:
            t0_ied = time.time()
            tIEC_adresse = GM.BrowseDataModel(ied)
            if ied.IP is None:
                ip = '0.0.0.0'
            else:
                ip = ied.IP
            nbDa = len(GM.tIED)
            Resultat = str(time.time() - t0_ied)
            TX.Trace(("Time for IED:" + ied.name + '(' + ip +
                      ") Number of DA:" + str(nbDa) + "Time" + Resultat),
                     TL.GENERAL)

            index = 0
            IED_ID = ied.name + ied.tAccessPoint[
                0].name  #  ied.name   # TODO ou ied.name+AP_Name
            for iec in tIEC_adresse:

                if iec.BasicType is None:
                    iec_BasicType = " - "
                if iec.TypeValue is None:
                    iec_TypeValue = " - "
                if iec.EnumType is None:
                    iec_EnumType = " - "

                TX.Trace(("MMS_ADR" + iec.mmsAdr + " FC:" + iec.fc +
                          " bType:" + iec_BasicType + " EnumType:" +
                          iec_EnumType + "Value:" + iec_TypeValue + "\n"),
                         TL.GENERAL)
                index = index + 1
        T1 = time.time()
        TempsTotal = str(time.time() - T0_Global)
        TX.Close()
        TR.Trace(("Total execution time" + file + ':' + TempsTotal),
                 TL.GENERAL)
        TR.Trace(("*** finished ***"), TL.GENERAL)
Example #5
0
 def __init__(self, _type, _pSCL, _pDataModel):
     ## type  - the private TAG
     self.type = _type
     ## pSCL - the pointer to the SCL, where the tag was found
     self.pSCL = _pSCL
     ## pDataModel - the pointer to the data model
     self.pDataModel = _pDataModel
     ## TR - the initialized trace service.
     self.TR = Trace.Console(TL.GENERAL)
Example #6
0
    def main(directory, file, scl):
        TRX = Trace.Console(TL.DETAIL)

        TRX.Trace(("---------------------------------------------------"), TL.GENERAL)
        if scl is None:  # UNIT TEST
            scl = dom.parse(directory + file)
        TRX.Trace(("File:" + file), TL.GENERAL)
        DataType     = scl.getElementsByTagName("DataTypeTemplates")
        LNodeType    = Parse_LNodeType(scl, TRX)
        tLNodeType, dicLNodeType = LNodeType.Create_LNodeType_Dict(DataType)
        TRX.Trace(("END OF IEC_LNodeType"), TL.GENERAL)
Example #7
0
    def main(directory, file, scl):
        TRX = Trace.Console(TL.DETAIL)

        TRX.Trace(("---------------------------------------------------"), TL.GENERAL)
        if scl is None:  # UNIT TEST
            scl = dom.parse(directory + file)
        TRX.Trace(("File:" + file), TL.GENERAL)
        sclSubstation   = scl.getElementsByTagName("Substation")
        if len(sclSubstation)!=0:
            station  = ParseSubStation(sclSubstation, TRX)
            tNetWork = station.ParseVoltageLevelSection(sclSubstation)  # <SubNetWork>
        TRX.Trace(("FIN IEC_SUBSTATION"), TL.GENERAL)
        def __init__(self, _ACSI, _ipAdrTools,
                     _desc):  # _ACSI will be None in System Case.
            self.ACSI = _ACSI
            self.ipAdrTools = _ipAdrTools
            self.desc = _desc
            self.T = TR.Console(TL.GENERAL)

            UTEST = import_module("utest")
            self.IEC = getattr(UTEST, "IECToolKit")

            self.uTest = self.IEC("Test dummy sytem)")
            self.mgr = self.uTest.Manager(_ipAdrTools)
    def main(directory, file, scl):
        TRX = Trace.Console(TL.DETAIL)

        TRX.Trace(("---------------------------------------------------"),
                  TL.GENERAL)
        if scl is None:  # UNIT TEST
            scl = dom.parse(directory + file)
        TRX.Trace(("File:" + file), TL.GENERAL)
        comm = scl.getElementsByTagName("Communication")
        subNetWork = ParseCommunication(comm, TRX)
        tNetWork = subNetWork.ParseCommSection(comm)  # <SubNetWork>
        TRX.Trace(("FIN IEC_SUBSTATION"), TL.GENERAL)
Example #10
0
    def main(directory, file, scl):
        TRX = Trace.Console(TL.DETAIL)

        TRX.Trace(("---------------------------------------------------"),
                  TL.GENERAL)
        if scl is None:  # UNIT TEST
            scl = dom.parse(directory + file)
        TRX.Trace(("File:" + file), TL.GENERAL)
        iIED = Parse_Server(scl, TRX)

        tIEDglobal = iIED.Parse_IED(TRX)
        TRX.Trace(("END of IEC_IED_Server"), TL.GENERAL)
Example #11
0
    def main(directory, file, scl):
        TRX = Trace.Console(TL.DETAIL)

        TRX.Trace(("---------------------------------------------------"),
                  TL.GENERAL)
        if scl is None:  # UNIT TEST
            scl = dom.parse(directory + file)
        TRX.Trace(("File:" + file), TL.GENERAL)
        DataType = scl.getElementsByTagName("DataTypeTemplates")
        DATypeTypeLst = Parse_DAType(scl, TRX)
        dico = DATypeTypeLst.Create_DAType_Dict(DataType)

        TRX.Trace(("FIN IEC_DAType"), TL.GENERAL)
Example #12
0
        def __init__(self, _ACSI, _ied, _File):
            self.ied = _ied  #
            self.TX = Trace.Console(TL.GENERAL)

            testAPI = API_Test("Verification conformité valeur")

            ACSI_API1 = testAPI.getAPI_TXT("DUMMY")
            dummy = ACSI_API1(_ACSI, '0.0.0.0', 'test loopback')
            self.IED_ID = dummy.Associate()

            ACSI_API2 = testAPI.getAPI_TXT("SYSTEM")
            System = ACSI_API2(_ACSI, '0.0.0.0', 'test System')

            if System.Associate() is not None:
                System.ReadDataPoint('LD_all/LLN0/OpTmh/stVal[ST]'
                                     )  ## 'LD_all/LLN0/OpTmh/stVal[ST]'

            ACSI_API3 = testAPI.getAPI_TXT("IED")
            IED = ACSI_API2(_ACSI, '0.0.0.0', 'test IED')
            self.IED_ID = IED.Associate()
Example #13
0
    def main(directory, file, scl):
        TRX = Trace.Console(TL.GENERAL)

        scl = dom.parse('SCL_files/' + file)
        TRX.Trace(("scl.getElementsByTagName. " + file), TL.GENERAL)
        tiLN = []

        instLN = Parse_LN(TRX)  # Class instance creation
        # Parse specifically LN0
        LN_ZERO = scl.getElementsByTagName("LN0")
        TRX.Trace(("ParseLN0................. " + file), TL.GENERAL)
        for ptrLN in LN_ZERO:
            tDAI = []
            iLN = instLN.Parse_LN(ptrLN, "IED_name", "AP_Name", tDAI)
            tiLN.append(iLN)

# Parse classical LN
        pLN = scl.getElementsByTagName("LN")
        for ptrLN in pLN:
            tDAI = []
            iLN = instLN.Parse_LN(ptrLN, "IED_name", "AP_Name", tDAI)
            tiLN.append(iLN)

        TRX.Trace(("IEC_LN fin"), TL.GENERAL)
Example #14
0
    def __init__(self):
        self.DicoPrivate = {}  ## For full tag name like 'RTE-FIP'
        self.TagList = [
        ]  ## For generic tag starting a simple name like 'RTE-', 'GE_', 'Siemens-'...
        self.TR = Trace.Console(TL.DETAIL)

        #       dicDoType[id] = {"import": cdc, "commentaire": desc, "tDA": tDA
        #                  start with TAG         class name
        ## Dictionary based:
        self.DicoPrivate['RTE-FIP'] = {
            "FileName": 'IEC_RTE_private',
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_FIP'
        }
        self.DicoPrivate['RTE-BAP'] = {
            "FileName": 'IEC_RTE_private',
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_BAP'
        }
        self.DicoPrivate['RTE-DAI_VAL'] = {
            "FileName": 'IEC_RTE_private',
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_DAI_VAL'
        }
        self.DicoPrivate['RTE-ICD_HEADER'] = {
            "FileName": 'IEC_RTE_private',
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_ICD_HEADER'
        }
        self.DicoPrivate['RTE-LD-ChangeLog'] = {
            "FileName": 'IEC_RTE_private',  # At DAI Level (Namplt/configRev]
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_LD_ChangeLog'
        }
        self.DicoPrivate['RTE-LD-Model-ChangeLog'] = {
            "FileName": 'IEC_RTE_private',  # At DAI Level (Namplt/swRev]
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_LD_Model_ChangeLog'
        }
        self.DicoPrivate['RTE-PARAM'] = {
            "FileName": 'IEC_RTE_private',
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_PARAM'
        }
        self.DicoPrivate['RTE-FunctionUUID'] = {
            "FileName": 'IEC_RTE_private',
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_FunctionUUID'
        }
        self.DicoPrivate['RTE-FunctionIndice'] = {
            "FileName": 'IEC_RTE_private',
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_FunctionIndice'
        }
        self.DicoPrivate['RTE-PhysicalTVTCbinding'] = {
            "FileName": 'IEC_RTE_private',
            "ClassName": 'RTE_Private',
            "MethodName": 'RTE_PhysicalTVTCbinding'
        }

        ## List based, the matching string is the begining of the private tag
        #                                             KEY/TAG    FileName               ClassName
        self.TagList.append(
            DynImport.privateTag('RTE-', 'IEC_RTE_private', 'RTE_Private',
                                 'RTE_Generic'))
        self.TagList.append(
            DynImport.privateTag('Siemens-', 'IEC_Siemens_private',
                                 'Private_Siemens', 'Siemens_Generic'))
        self.TagList.append(
            DynImport.privateTag('ABB_', 'IEC_ABB_private', 'Private_ABB',
                                 'ABB_Generic'))
        self.TagList.append(
            DynImport.privateTag('GE_', 'IEC_GE_private', 'Private_GE',
                                 'GE_Generic'))
        self.TagList.append(
            DynImport.privateTag('MiCOM-', 'IEC_MiCOM', 'Private_MiCOM',
                                 'MiCOM_Generic'))
Example #15
0
        self.desc = _desc

    def getAPI_TXT(self, mode):
        if mode == "IED":
            return (TEST.IED)
        if mode == "SYSTEM":
            return (TEST.System)
        if mode == "DUMMY":
            return (TEST.Dummy)


##
# \b MAIN call the unitary test 'Test_ParcoursDataModel'
if __name__ == '__main__':

    TX = TR.Console(TL.GENERAL)
    TR1 = TR.Console(TL.DETAIL)
    TXF = TR.File(TL.DETAIL, "Trace_FctTst.txt")
    tIEDfull = []

    myCpt = 0

    tstAPI = API_Test("test iedIED")
    dumACSI = tstAPI.getAPI_TXT("DUMMY")
    iedACSI = tstAPI.getAPI_TXT("IED")
    sysACSI = tstAPI.getAPI_TXT("SYSTEM")

    for file in FileListe.lstSystem:

        GM = globalDataModel(TX, 'SCL_files/' + file, None)
Example #16
0
        Watts = 62
        VAr = 63
        phi = 64
        cos_phi_ = 65
        Vs = 66
        V2 = 67
        As = 68
        A2 = 69
        A2t = 70
        VAh = 71
        Wh = 72
        VArh = 73
        V_per_Hz = 74
        Hz_per_s = 75
        char = 76
        char_per_s = 77
        kgm2 = 78
        dB = 79
        J_per_Wh = 80
        W_per_s = 81
        l_per_s = 82
        dBm = 83


if __name__ == '__main__':
    TRX = Trace.Console(TL.DETAIL)
    TRX.Trace(("IEC_Enum Dbpos", IEC_Enum.Dbpos.pos_off), TL.GENERAL)
    TRX.Trace(("IEC_Enum Beh", IEC_Enum.Beh.blocked), TL.GENERAL)
    TRX.Trace(("IEC_Enum Health ", IEC_Enum.Health.Warning), TL.GENERAL)
    TRX.Trace(("IEC_Enum SI_Unit", IEC_Enum.SI_Unit.dBm), TL.GENERAL)
Example #17
0
 def __init__(self):
 ## TRX is the initialized trace method
     self.TRX = Trace.Console(TL.GENERAL)
Example #18
0
    def CheckAllValue(mode):

        TX = Trace.Console(TL.GENERAL)
        tIEDfull = []
        for file in FileListe.lstSystem:

            CG = CheckDataInitialValue("CodeGeneration")
            GM = globalDataModel(TX, 'SCL_files/' + file, None)

            indIED = 0
            T0_Total = time.time()

            for ied in GM.tIED:

                IedAP_Model = GM.tIED[indIED].tAccessPoint[0].tServer[0]
                T0_IED = time.time()
                tIEC_adresse = GM.BrowseDataModel(ied)
                IEDcomplet = CG.IEDfull(ied, tIEC_adresse)
                tIEDfull.append(IEDcomplet)
                nbDa = str(len(tIEC_adresse))
                if ied.IP is None:
                    ip = '0.0.0.0'
                else:
                    ip = ied.IP
                Resultat = str(time.time() - T0_IED)
                TX.Trace(("Time for IED:" + ied.name + '(' + ip +
                          ") Number of DA:" + nbDa + "Time:" + Resultat),
                         TL.GENERAL)

                ACSIparam = ACSI(ied.name, ied.IP, ied.tAccessPoint[0].name,
                                 IedAP_Model.timeout, IedAP_Model.desc,
                                 tIEC_adresse)

                if mode == 'CodeGeneration':
                    Check = CheckDataInitialValue.CodeGen(
                        ACSIparam, IEDcomplet, ied.name + '.py')
                if mode == 'Connected':
                    Check = CheckDataInitialValue.Connected(
                        ACSIparam, IEDcomplet, ied.name + '.py')

    #            directAdress = ied.Server[0]
    #            'PwrQual$PQi$LLN0$Mod$ST$stVal'
    # Manque stVal q t
                i = 0  # Index to DataPoint
                IED_ID = ied.name  # TODO ou ied.name+AP_Name
                for iec in tIEC_adresse:
                    if iec.IntAdr is None:  ## 'q' and 't' are excluded
                        continue
                    Check.DataPointcheck(iec, i)

                    A = "GM.tIED[" + str(
                        indIED
                    ) + "].tAccessPoint[0].Server[0]." + iec.IntAdr  ## 'q' and 't' are excluded
                    AdrValue = "GM.tIED[" + str(
                        indIED
                    ) + "].tAccessPoint[0].tServer[0]." + iec.IntAdr + ".value"
                    try:
                        Test = eval(
                            AdrValue
                        )  # Verify existence of some initialisation data
                        Value = eval(AdrValue)

                        if (Value != None):
                            Check.CheckDAivalue(iec, AdrValue, Value)

                    except Exception as inst:  # No data, an exception is expected hera
                        A = type(inst)
                        if (A == "<class 'AttributeError'>"):
                            break
                    i = i + 1

                TX.Trace(("IED:" + IED_ID + "nbDA:" + str(nbDa) +
                          " NbMmsADr:" + str(i)), TL.GENERAL)
                Check.TX.Close()
                indIED = indIED + 1

            TempsTotal = str(time.time() - T0_Total)
            TX.Trace(("Total Time:" + file + ':' + TempsTotal), TL.GENERAL)
        TX.Trace(("*** finished *** "), TL.GENERAL)