MechEngi

Get Event Name string from Troubleshooter / Event Code

9 posts in this topic

Hi,

Is there a way to write an Event Name to a string variable in Sysmac Studio? I'm using a NJ-301.

My problem is that I can detect that there is an error and get the Error Code using functions GetECError, GetMCError, GetPLCError, etc, but I want to get the Event Name associated with the code (in a string variable), to display that string on an HMI (not from Omron).

Is this possible?

GetMCerror.png

Troubleshooter.png

Share this post


Link to post
Share on other sites

It's fairly common in the Rockwell world for those strings to be generated solely in the programming software, and not be present in the PLC at all.  Wouldn't surprise me if that is true for Omron as well.

Share this post


Link to post
Share on other sites

String seem to be static. Sysmac Studio have directory to store definition : "C:\Program Files\OMRON\Sysmac Studio\ErrorDefinition".
Definition is XML file about 3Mb, one for each language, for English is : "SysErrDef-en-US.xml".
You can search the error code in this file and get the EventName string.

Not very simple!

 

1 person likes this

Share this post


Link to post
Share on other sites
1 hour ago, JYG said:

String seem to be static. Sysmac Studio have directory to store definition : "C:\Program Files\OMRON\Sysmac Studio\ErrorDefinition".
Definition is XML file about 3Mb, one for each language, for English is : "SysErrDef-en-US.xml".
You can search the error code in this file and get the EventName string.

Not very simple!

 

It's not perfect, but this is actually very helpful ! Thank you very much !

Share this post


Link to post
Share on other sites

For anyone interested, I extracted the "Code" and "EventName" attributes of every entry of the XML mentionned by JYG (very simple in Python), and exported it to a CSV file. File is attached.

AlarmList.csv

Share this post


Link to post
Share on other sites

My Sysmac Studio version is 1.55 and have 2357 EventInfo, yours have 2220 EventInfo.

Share this post


Link to post
Share on other sites
1 hour ago, MechEngi said:

For anyone interested, I extracted the "Code" and "EventName" attributes of every entry of the XML mentionned by JYG (very simple in Python), and exported it to a CSV file. File is attached.

AlarmList.csv

Based on the post from @JYG it appears the XML is different for each version of Sysmac Studio {dooh - no surprise here} .

Would you want to post the python script(s) you used to create your CSV so others could parse their own XML files?

1 person likes this

Share this post


Link to post
Share on other sites

You can use Excel or LibreOffice Calc to import XML file, here with Excel :

  1. Click Developer > Import
  2. Remove no interesting columns
  3. Click on Data > Remove duplicate
  4. Save as a CSV

Share this post


Link to post
Share on other sites
On 7/25/2023 at 3:12 PM, BobLfoot said:

Would you want to post the python script(s) you used to create your CSV so others could parse their own XML files?

Happy to, but again, @JYG 's solution is simpler and efficient.

I coded another script in Python to import all these Event Name to an array variable in Python. The setup is again pretty simple :

  1. Create a Structure Data Type with 2 members:
    1. Name : "Code", Base Type : "DWORD"
    2. Name : "EventName", Base Type : "STRING[100]"
  2. Create an array variable called OmronAlarmList[2220] (could be 2357 if you have Sysmac version 1.55 as @JYG mentionned). Make sure to make it "Retain"
  3. Download to the PLC
  4. Export your variables while online with the PLC
    1. Tools -> Backup -> Backup Variables and Memory
    2. In the XML generated by Sysmac, scroll to the 1st entry of variable OmronAlarmList[0].Code and delete everything up to the last entry of OmronAlarmList[2219].EventName
    3. Paste the following text to replace the values of the variable with the ones I imported through my script (file is attached)
      1. Make sure to select the line that was previously occupied by <Item Name="VAR://OmronAlarmList[0].Code" DataType="DWORD">
    4. Save the modified XML
    5. Import in Sysmac while online with the PLC
      1. Import only this specific variable to prevent any corruption

It worked like a charm for me !

Omron Alarm List.xml

Edited by MechEngi
Wrong "enter"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now