I just finished writing the entire AOI over a 12-hour stretch today (reliable VFD reads and auto-configuration, tested on 8x VFD) and will do some clean-up later.
I'll cover the parameter reads in this post. I'm tired.
Interesting! How did you read all that data from the drive without data links? I'd imagine you could do it with a message instruction, but then message instructions within AOI's are a huge PITA in my (recent) experience.
Yep. Messaging and it's super easy.
First, read up on scattered reads
here, Chapter 6 Page 75.
Briefly, the AOI will be instantiated per VFD and my preference is program-scoping these every time. This is done on either a 5370 or 5380.
The message you create will be IN/OUT parameter to the AOI. You will need one of these messages per VFD. On a 5370 controller, that'll make it a controller-scoped tag. On a 5380 and beyond, it can be program-scoped alongside the AOI.
The only properties you need to set up within the first message instance are:
- Message Type: CIP Generic
- Service Type: Custom
- Service Code: 32
- Source Element: Array of INT. Size = 2x number of desired VFD parameters to read. Max: 64 parameters = 128 INT.
- Source Length: 2x the number of VFD parameters you want to read. Max: 64 parameters * 2 bytes per = 256 bytes.
- Destination Element: Use the same array you created above. Ignore everything Rockwell says about needing two INT arrays. You just need one: the Destination element will be the Source. On a 5370 controller, this is controller-scoped. It can be program-scoped alongside the Message on a 5380. More on the array!
- Path: Name of the VFD Module within your project tree.
The array is also an IN/OUT parameter to the AOI.
The remaining messages can be copied and pasted within 5000 and the properties you've configured will be copied as well. You just need to adjust the path.
The rest of the message properties can be set up within the AOI, to save time and reduce error:
Code:
MessageName.Class := 16#0093;
MessageName.Instance := 0;
MessageName.Attribute := 16#0000;
Here's how the scattered read works:
- You provide the desired parameters in the even-indexed array elements.
- Example: I wanted the three most recent fault codes, output frequency, and bus voltage:
Code:
array[0] := 7;
array[2] := 8;
array[4] := 9;
array[6] := 1;
array[8] := 5;
- When the message is triggered, the entire array block is transmitted to the VFD.
- The VFD returns the block, having populated the adjacent odd-indexed elements with values:
Code:
array[1] has 73 // fault 73
array[3] has 114 // fault 114
array[5] has 4 // fault 4
array[7] has 5702 // output frequency, more on this one
array[9] has 702 // bus voltage
- Where and what parameters can be retrieved? All of them! The 525 manual here has them all starting at Chapter 3 Page 76.
- Drop the prefix character and any leading zeroes. (i.e. Bus Voltage B005 is just '5')
- The returned parameters are integral values so, in several cases, you will need to convert the returned values. In others, it's one-to-one.
- Converting read values is easy: In the 525 manual, the 'Display' property is all you need.
- We read parameter 1 earlier, with a Display 0.01 Hz, so conversion is easy:
Code:
OutputFrequency := array[7] * 0.01;
OutputFrequency equals 57.02 now
- The bus voltage is already integral:
This buys you up to 64 parameters. Persistence will net you even more. Playing to win will yield an AOI with messaging that never fails.