Have a question? Join our community of pros to take part in the discussion! You'll also find all of our automation courses at. ![]() Senior Controls Engineer and Freelance Writer If you take the time to learn each instruction, their parameters and use, then you will be setting yourself up for success in your automation and controls career. If you are new to ControlLogix programming, hopefully you have picked up a tip or two here. This is a real-life application that I have used many times for calculating weight signals and averaging the weight over several seconds. The FFL and FFU instructions working together with and AVG instruction can give you great flexibility in adjusting the sample rate by simply adjusting the timer value that executes the instructions. The following is a snapshot of what your array will look like in the controller tag database: Image by Brandon Cooper Conclusion: Depending on what you are trying to accomplish, you may only need a sample every ten seconds, or you may need a sample every fifty milliseconds Increase or decrease the timer preset to have faster or slower sampling: In this example I’ve adjusted the TIMER_LAB.PRESET to five hundred milliseconds, which results in the code sampling and store the signal value twice a second.Make the array larger: Instead of only 16 stored data points as in this example, your array could be 50 points or more.(- ed.) NOTES: Adjustments for sampling options: This value is typically set initially to 0. Position – The offset into the selected array which the instruction is accessing. In some situations you may only want or need to Average a part of the array, but it’s more common to Average all of the stored variables. Length – The length of the array to AVERAGE. The AVG instruction needs to have its own dedicated CONTROL tag. Consider this a “MOV” block inside the AVG instruction.Ĭontrol – This will be a CONTROL data type similar to the one used in the FFL and FFU instructions, but can not be the same tag as the FFL and FFU instructions. This parameter allows users with multi-dimensional arrays to select the dimension in the array to use (- ed.)ĭestination – Where to place the Result of the Average Instruction. To Vary – The array’s Dimension to use (0, 1, 2) With the FFL and FFU covered, the next step is to use the AVG instruction to average the values we’ve collected and stored in our array, and below I’ll detail the AVE’s parameters:Īrray – The Array which hold the values you wish to calculate an Average ofĭem. I chose a tag called “Trash” because I don’t need the variable once it has been unloaded.Ĭontrol – This can be any tag name and select “CONTROL” as the data type.Īs noted above, the corresponding “FFL” instruction must use the same tag in its “Control” parameter so that they operate simultaneously. In this example I’m using the same ACCArray with a DINT data type used above.ĭestination – The variable that is being “Unloaded” from the array will be moved to this destination. Position – Position to Load the Array FFU (FIFO Unload) Instruction Parameters:įIFO – The Array in which to Unload the variable. This is usually the same length as the Tag Array used in the FIFO parameter. Note that the corresponding “FFU” (FIFO Unload) instruction must use the same tag in its “Control” parameter so that they operate simultaneously. In this example I’m using ACCArray with a DINT data typeĬontrol – This can be any tag name with “CONTROL” as the data type. ![]() ![]() Generally, this would be a process variable like a weight scale, pH, or temperature.įIFO – The Array in which to store the signal or variable. Source – The signal or variable that you want to store in the array. We can accomplish this by using a Timer to trigger FFL and FFU instructions, and below I cover each of their parameters: Image by Brandon Cooper The first step is of the process is to record samples of your value or analog signal (level, temperature, pressure, etc) over a given amount of time. In today’s article I’ll walk you through setting the parameters of these instructions to do just that. These instructions are commonly used to store multiple records at a given sample rate, which then can be averaged. In a previous article regarding ControlLogix processor faults, I mentioned one of the ways a processor can be faulted was by causing an array to go out of bounds when using an FFL and FFU instruction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |