You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old August 9th, 2018, 11:50 AM   #1
dmoore26
Member
United States

dmoore26 is offline
 
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.
  Reply With Quote
Old August 9th, 2018, 12:30 PM   #2
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 5,463
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:
Total_Weight + Sector_Weight[MUTT.Pos]
note that you'll have to use something like a CLR (Clear) instruction just before the FAL to clear out the old total before you add up the array again ...

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 ...
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.


Last edited by Ron Beaufort; August 9th, 2018 at 12:45 PM.
  Reply With Quote
Old August 9th, 2018, 12:33 PM   #3
cwal61
Member
United States

cwal61 is offline
 
Join Date: Jan 2011
Location: NC
Posts: 981
I did it this way. It seems to work. Put 1,2,3,4,5 in the Array[0]-[4] got 15
Attached Images
File Type: png FALTotal.PNG (38.3 KB, 69 views)
  Reply With Quote
Old August 9th, 2018, 12:58 PM   #4
dmoore26
Member
United States

dmoore26 is offline
 
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?
  Reply With Quote
Old August 9th, 2018, 01:25 PM   #5
cwal61
Member
United States

cwal61 is offline
 
Join Date: Jan 2011
Location: NC
Posts: 981
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.
  Reply With Quote
Old August 9th, 2018, 01:26 PM   #6
dmoore26
Member
United States

dmoore26 is offline
 
Join Date: Jul 2017
Location: Virginia
Posts: 6
I have it working now, I appreciate the help.
  Reply With Quote
Old August 10th, 2018, 04:38 AM   #7
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,401
Quote:
Originally Posted by dmoore26 View Post
I have it working now, I appreciate the help.
Make it easier on yourself, no need for a FAL ...

Average (AVE) = SUM / Number of elements

So SUM = Average * Number of elements
Attached Images
File Type: jpg 2018-08-10_093648.jpg (87.8 KB, 36 views)
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
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


All times are GMT -5. The time now is 09:10 AM.


.