UDT Expression Tag Dictionary

Im trying to get the Fault1Description expression tag to return a string message based on the value of Fault1Code but only when Faulted is True. I want this string to show up on the display path of the Faulted bit’s Alarm.

I created a dictionary with all the possible VFD fault codes & brief description as key-value pairs. Test ran the code in the script console and it worked.

I then copied & pasted the code into Fault1Description>Expression and modified it to look like this:

Fault1CodeDict = {0 : ' -- F000 - No Fault',
2 : ' -- F002 - Auxiliary Input',
3 : ' -- F003 - Power Loss',
4 : ' -- F004 - UnderVoltage',
5 : ' -- F005 - OverVoltage',
6 : ' -- F006 - Motor Stalled',
7 : ' -- F007 - Motor Overload',
8 : ' -- F008 - Heatsink OvrTmp',
9 : ' -- F009 - CC OvrTmp',
12 : ' -- F012 - HW OverCurrent',
13 : ' -- F013 - Ground Fault',
15 : ' -- F015 - Load Loss',
21 : ' -- F021 - Output Ph Loss',
29 : ' -- F029 - Analog In Loss',
33 : ' -- F033 - Auto Rstrt Tries',
38 : ' -- F038 - Phase U to Gnd',
39 : ' -- F039 - Phase V to Gnd',
40 : ' -- F040 - Phase W to Gnd',
41 : ' -- F041 - Phase UV Short',
42 : ' -- F042 - Phase UW Short',
43 : ' -- F043 - Phase VW Short',
48 : ' -- F048 - Params Defaulted',
59 : ' -- F059 - Safety Open',
63 : ' -- F063 - SW OverCurrent',
64 : ' -- F064 - Drive Overload',
70 : ' -- F070 - Power Unit',
71 : ' -- F071 - DSI Net Loss',
72 : ' -- F072 - Opt Net Loss',
73 : ' -- F073 - EN Net Loss',
80 : ' -- F080 - Autotune Failure',
81 : ' -- F081 - DSI Comm Loss',
82 : ' -- F082 - Opt Comm Loss',
83 : ' -- F083 - EN Comm Loss',
91 : ' -- F091 - Encoder Loss',
94 : ' -- F094 - Function Loss',
100	: ' -- F100 - Parameter Chksum',
101	: ' -- F101 - External Storage',
105	: ' -- F105 - C Connect Er',
106	: ' -- F106 - Incompat C-P',
107	: ' -- F107 - Replaced C-P',
109	: ' -- F109 - Mismatch C-P',
110	: ' -- F110 - Keypad Membrane',
111	: ' -- F111 - Safety Hardware',
114	: ' -- F114 - Microprocessor Failure',
122	: ' -- F122 - IO Board Failure',
125	: ' -- F125 - Flash Update Req',
126	: ' -- F126 - NonRecoverablErr',
127	: ' -- F127 - DSIFlashUpdatReq',}

print (Fault1CodeDict[{[.]Fault1Code}])

When I go in the Tag Browser and open up the ConvVFD instances I see this:

When I hold the cursor over the red X, it says “error configuration”.

Also, what would be the proper way to add this string to the existing display path? This is what it looks like at the moment:

{Area} + " " +{ConveyorNumber} +" VFD Fault (" + {VFDNumber} + ")"

Dictionaries are python/jython, as is the script console. Expression tags need functions and operators from Ignition’s expression language. That isn’t jython at all.

Consider creating a dataset memory tag with the contents of your dictionary in two columns. Then the expression language’s lookup() function can pick the string as the fault code changes.

2 Likes

Thank you!!