Gateway scripts or expression

You have 48 readBlocking events in that script.

This has two.

def find_activeAlarm_tags():
    # Initialize an empty list to store matching tag paths
    tagPaths = []
    tagNrPaths = []
    Alarm_tags = []

    # Define the range of tag names
    for i in range(24):
        action_tag = "Action" + str(i)
        # Create a tag path for the current tag
        tagPaths.append("[Test SCADA Ignition]Action/{}/hmi/prompt".format(action_tag))
        tagNrPaths.append("[Test SCADA Ignition]Action/{}/obj/nr".format(action_tag)
    
    # Get the tag values
    tag_values = system.tag.readBlocking(tagPaths)
    tag_Nrs =  system.tag.readBlocking(tagNrPaths)

    for i in range(24):
        # Check if the prompt value is greater than 0
        if tag_values[i].value:
            # Add the tag path to the list if the condition is met
            Alarm_tags.append(i)

    # Return the list of matching tag paths
    return Alarm_tags

See if that makes a difference.
Then see if you can reduce it to one readBlocking.


Tip: you have three different font sizes and two different styles (normal and bold) on that screenshot as well as buttons breaking into the text area. It is not nice and visually very distracting! Have a look at some visual style guides to get some ideas for better layout.

1 Like