![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]()
|
New Here? Please read this important info!!!
![]() |
#1 |
Member
![]() ![]() Join Date: Jul 2017
Location: Virginia
Posts: 6
|
Summing an array in Logix5000 using FAL
I am attempting to use the FAL instruction in 5000 to sum an array. The logic is running in a ControlLogix PLC. I have searched this forum and others, but cant seem to find an example of what i want to do. The array is 263 in length(263 foot conveyor). There is a scale on the conveyor that gives me LBS/FT and FT/S. I use that to calculate how fast I move the newest weight measurement into the array. I need to constantly sum the entire array to calculate the total weight on the conveyor. Does anyone have an example on how to sum an array using FAL? I want to use the FAL to make the code cleaner because I have to do this for multiple conveyors.
|
![]() |
![]() |
#2 | |
Lifetime Supporting Member
|
are you confused with how to write the Expression? ... or what? ...
if it's the Expression that's causing you problems, try something like this ... suppose that your Control entry is MUTT ... suppose that your array is named Sector_Weight[0] through Sector_Weight[262] ... suppose that your Destination entry is Total_Weight ... try entering your Expression as Quote:
if this doesn't fix it - post more details (or better yet a section of your code) and we'll help you nail it down ... good luck with your project ...
__________________
Last edited by Ron Beaufort; August 9th, 2018 at 12:45 PM. |
|
![]() |
![]() |
#3 |
Member
![]() ![]() Join Date: Jan 2011
Location: NC
Posts: 1,010
|
I did it this way. It seems to work. Put 1,2,3,4,5 in the Array[0]-[4] got 15
|
![]() |
![]() |
#4 |
Member
![]() ![]() Join Date: Jul 2017
Location: Virginia
Posts: 6
|
My expression is the same as the examples. Maybe i misunderstood how the instruction works, but as the conveyor continues to run and no more material is added to it, a weight of "zero" is moved into the the array for every foot of travel until its nothing but zeros. At that point i would expect it to be summing all zeros and my total should be zero. So at this point, i guess my question is, am i expecting FAL to do something it cannot?
|
![]() |
![]() |
#5 |
Member
![]() ![]() Join Date: Jan 2011
Location: NC
Posts: 1,010
|
If your total is part of the expression. Then the total must be cleared each scan to obtain a new total once the FAL is activated. The instruction can be used to accomplish your task but I do not know what expression your using. There are many examples to choose from. So it would help if you showed us the expression your using.
|
![]() |
![]() |
#6 |
Member
![]() ![]() Join Date: Jul 2017
Location: Virginia
Posts: 6
|
I have it working now, I appreciate the help.
|
![]() |
![]() |
#7 |
Lifetime Supporting Member + Moderator
|
Make it easier on yourself, no need for a FAL ...
Average (AVE) = SUM / Number of elements So SUM = Average * Number of elements
__________________
___________________________ ![]() abtrain@tiscali.co.uk www.abtrain.co.uk tel: 07506 73 9999 nil illegitimi carborundem |
![]() |
![]() |
Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Logix5000 average the non-zero values in a real array of fixed length | tmadore | LIVE PLC Questions And Answers | 3 | May 31st, 2017 04:41 AM |
Logix5000 Array element compare and reset | jholm90 | LIVE PLC Questions And Answers | 3 | May 29th, 2016 06:47 AM |
Time Array Comparison Logix5000 | whussain6 | LIVE PLC Questions And Answers | 3 | May 17th, 2016 10:52 AM |
Variable array size call to add-on instruction - A solution | Mr Modbus | LIVE PLC Questions And Answers | 4 | July 17th, 2015 08:59 AM |
Array Copy in Logix5000 | cmac2425 | LIVE PLC Questions And Answers | 4 | April 23rd, 2014 10:48 AM |