Pradeep Kumar
Pradeep Kumar

Reputation: 11

Not able to read OPC tags after 30 minutes of restarting the Server

Earlier, I was getting timeout error in reading some tags so I declared a method readOPCTags(), which will take a tag as an argument and return its values in tuple if it is taking more than the specified time in getting the value of the tag then the method will be skipped. But It is not able to read the OPC tags after 30 minutes of restarting the server machine The code is Given below.

def readOPCTags(tag) :
    tagValue = opc.read(tag)
    return tagValue

I am taking a tag from an array and passing it to the readOPCTags method, the caller method is given below.

def GetTagsValues(tags) :
    tagsValues = []
    tagsToRead = getTagsWithGroup(tags)

traverse each tag of tagsToread array pass it to the method readOPCTags which returns a tuple containing values of the tag

    for tag in tagsToRead :
        obj = {} # containing tags name as key and tagsvalue as value

        try :
            # calling readOPCTags method to get values of tag within a certain specified time
            tupleOfTagValue = func_timeout(maxExecutionTime, readOPCTags, args = (tag,))

            # calling getDictOfTagvalues method to get tag values in an object
            objOfTagValues = getDictOfTagvalues(tupleOfTagValue)
            obj[tag] = objOfTagValues
            tagsValues.append(obj)

        except Exception as e:
            # print(e)

used continue, so that after getting time out error, program may not terminate

            continue        
    return tagsValues

Upvotes: 1

Views: 96

Answers (0)

Related Questions