Efficient way to import 500+ alarms into ignition from Allen Bradly plc

hello,

I have easily 500+ alarms in DINT form as shown below.

How can i easily import this into my project? i cant do it through the tag browser as you cant explore to the bit level with the Allen Bradly driver. I would prefer to avoid doing these manually 1 by 1.

Can i export them and run them through some conversion then manually import?

Thanks

Edit:

this guy seems to have asked the same question Looking for a way to import tags from Studio5000 into Ignition?

has any other other programmer been in this situation that can provide some insight?

Alright after researching & I could be wrong but there doesn't appear to be an easy solution to this which is a shame as other systems/hmi packages make this process a lot easier for the average Rockwell programmer.

I know notepad++ regex reasonably well so got it done in about 30 minutes using that, was it the best way to do it? probably not. Would knowing scripting/python have made it easier? yes. Would this solution work on 1000s of tags? probably not. but I don't know jython/python so worked with the tools I had and 500 was manageable

For future readers.

I created a blank generic alarm template tag in ignition that triggered on bit state change. I then exported it to a .json file

    {
		"valueSource": "opc",
		"opcItemPath": "ns\u003d1;s\u003d[HC Man]HMI_Alarms[X].X",
		"dataType": "Int4",
		"alarms": [
			{
			"mode": "Bit",
			"name": "XXX",
			"label": "",
			"ackMode": "Auto"
			}
		],
		"name": "XXX",
		"tagType": "AtomicTag",
		"opcServer": "Ignition OPC UA Server"
	},

I then cloned that 500 times and used notepad++ regex's to fill in the X's. Once I was happy I imported the .json file and all worked as planned. Was surprisingly quick once I had it setup. Could probably do a few 1000 alarms in an hour or so this way. I would advise against this on new projects & bigger projects and use UDTs instead but for a quick fix to integrate older pre-established PLC code into ignition it did the job

So unfortunately, there is no straightforward built in way of doing this in Ignition. What I ended up doing was writing a python script to import all the tags from an excel spreadsheet into Ignition. Took a little bit to figure out python, but once i got it figured out I haven't had any issues since then. Basically have an excel spreadsheet that originally used to just generate the ASCII logic for the alarms in Logix Designer but now it also is used by my script to generate the alarm tags in Ignition. Ignition has a built in script console that runs python script, this can be used to do pretty much anything you want to the project.

Sounds like you came to the same conclusion, you can probably make it easier on yourself by making it loop based and have it loop through rows in a spreadsheet instead of having 500 instances of the same chunk of script.

1 Like

Yea I come to the same conclusion, may have to learn how to do this in python if have to import any more alarm tags :joy:

Its probably something inductive automation should look into given how often i assume people come across this issue especially with Rockwell stuff being everywhere. I understand its driver related but still an issue none the less.

1 Like

Ignition is platform agnostic, so you're not always going to find an easy button for the specific task you have. One thing to note, most Ignition projects that I do/see don't do alarms like you are showing. Most will leverage UDTs.

However, while there isn't necessary a native way, it is simple enough to do with scripting.

Reach out to @Chris_Mithiri, perhaps he will share his script.

3 Likes

this would be easy to do using a csv file and the scripting function to create tags.

I've written this about 3 separate occasions in java, C# and python. So I'm just going to post this here.

Here's a python script that converts a copy of the alarm table out of FactoryTalk View Studio in a xlsx format (need to copy into excel and save) and converts it into a xml file that you can directly import into Ignition. I also created a sheet for each program that the fault tags have scope in on the PLC.

Here's an xlsx example. Again just copy paste from factorytalk view studio.
HMI_alarms.xlsx (80.6 KB)

Please note that the alarms are all set as bit triggering in FactoryTalk as 8 bit values.

import pandas as pd
import subprocess
import json
import tkinter as tk
from tkinter import simpledialog
import re
import copy
import parser

alarmTemplate = {
          "shelvingAllowed": True,
          "name": "Alarm0",
          "label": "Fertigation Conveyor-Pallet Location 1-Pallet Missing-H2042-PRS",
          "displayPath": "Fertigation1/Conveyor",
          "ackMode": "Unused",
          "bindType": "Bit",
          "bitPosition": 0     
        }

tagTemplate = {
      "valueSource": "opc",
      "opcItemPath": "ns\u003d1;s\u003d[Fertigation1]Program:Fertigation_Conveyor.Conveyor.Fault[0]",
      "dataType": "Int1",
      "alarms": [],
      "name": "Fault_0_",
      "tagType": "AtomicTag",
      "opcServer": "Ignition OPC UA Server"
    }

tagFile = {
      "name": "Fault",
      "tagType": "Folder",
      "tags": []
    }

tags = {
      "name": "Faults",
      "tagType": "Folder",
      "tags": []
    }
# ROOT = tk.Tk()

# ROOT.withdraw()
# # the input dialog
# USER_INP = simpledialog.askstring(title="Test",
#                                   prompt="What's your Name?:")

# # check it out
# print("Hello", USER_INP)


xl_file = pd.ExcelFile("HMI_alarms.xlsx")


opcPath = "ns\u003d1;s\u003d[Fertigation1]"

sheets = {}


for sheetName in xl_file.sheet_names:
  sheets[sheetName] = xl_file.parse(sheetName)

  print (sheetName)
  tagFolder = None
  tagFolder = copy.deepcopy(tagFile)

  for index, line in sheets[sheetName].iterrows():

    if(line['TriggerValue']==1):
      tag = None
      tag = copy.deepcopy(tagTemplate)

      #{[PLC]Cell.SafetyFault[0]}

      tag['opcItemPath'] = opcPath + line['Trigger'][6:-1]
      name = str(line['Trigger'])
      tag['name'] = re.sub('\[|\]', '_', name.split('.')[-1].strip('}'))

      
    
    alarm = alarmTemplate.copy()

    alarm['name'] = 'Alarm' + str(index)
    alarm['label'] = line['Message']
    alarm['mode'] = "Bit"   
    alarm['bitPosition'] = line['TriggerValue'] - 1
    alarm['displayPath'] = 'Fertigation1/' + sheetName
            
    tag['alarms'].append(alarm)


    # if(line['TriggerValue']==8):
    #   print('************************')
    #   print(str(tag))      
        
    tagFolder['tags'].append(tag)

  tagFolder['name'] = sheetName

  tags['tags'].append(tagFolder)


  
with open('data.json', 'w', encoding='utf-8') as f:
    json.dump(tags, f, ensure_ascii=False, indent=4)
3 Likes

Is this HMI alarms or out of the Alarm and Events Export?

HMI alarms list from FactoryTalk View ME Studio.

From what I understand, Ignition's OPC Server, and any other non-Rockwell OPC server, doesn't support Rockwell's Alarms and Events feature (at their current states).

Yes, that's true. But these are tag based Factory Talk Alarms that are actually in the Alarms and Events Server that can be exported as an excel sheet. I believe at one point that they were HMI alarms that were converted after they quit supporting that function after version 10. I've been a little out of the game so my scripting is along the lines of a google admin, so I've been trying to get them to import. If not, thank goodness I got an ergonomic keyboard as I got about 2600 alarms and events to bring into ignition.

Hi all,
It's 2024 now. Must be someway we can import an large ammount of alarms excel based sheet to Ignition?

There has been a way to add tags and alarms for a while. You can easily write a script to do this very thing. What might not exist is a canned solution tailored to your exact need.

I use Excel quite often to do a bulk import of tags, but it's made for my exact need. There are many examples on this forum on how to do it.

Thanks Jland

THere are xml, json and csv type of importing way. Not sure which one should I look at. I'm trying to import alarm tags which is tag and its configuration such as description,...

I'd say you are using csv method for excel importing, am I right?

I don't use the canned tag import methods. I create a custom Excel file that I read and parse with a script, then programmatically create tags and alarms.

1 Like