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 June 17th, 2017, 07:30 PM   #1
bluenoser337
Member
Canada

bluenoser337 is offline
 
bluenoser337's Avatar
 
Join Date: Apr 2003
Location: Nova Scotia
Posts: 333
Min / Max

Searched but can't find an instruction in Studio 5000 to return the min and max values from a block of numbers (file, array...whatever). I wrote code to do this in a SLC and can do it again but thinking there must be something in 5000 to provide this functionality all these years later. Thanks!!
  Reply With Quote
Old June 17th, 2017, 07:36 PM   #2
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 3,953
Quote:
Originally Posted by bluenoser337 View Post
Searched but can't find an instruction in Studio 5000 to return the min and max values from a block of numbers (file, array...whatever). I wrote code to do this in a SLC and can do it again but thinking there must be something in 5000 to provide this functionality all these years later. Thanks!!
SRT

element 0 will be min, element {size of-1} will be max
__________________
___________________________
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
Old June 17th, 2017, 07:42 PM   #3
bluenoser337
Member
Canada

bluenoser337 is offline
 
bluenoser337's Avatar
 
Join Date: Apr 2003
Location: Nova Scotia
Posts: 333
Thanks daba! Forgot to mention that also I need the positions where the highest and lowest numbers were located. That could complicate things. Did it before with indexed addressing. For example: Highest pressure from sensor 12 at 99 PSI and lowest pressure from sensor 43 at 12 PSI.
  Reply With Quote
Old June 17th, 2017, 08:24 PM   #4
Operaghost
Member
United States

Operaghost is offline
 
Operaghost's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA USA
Posts: 2,518
MINC and MAXC. You'll have to write code to capture a position.

OG
  Reply With Quote
Old June 17th, 2017, 10:01 PM   #5
bluenoser337
Member
Canada

bluenoser337 is offline
 
bluenoser337's Avatar
 
Join Date: Apr 2003
Location: Nova Scotia
Posts: 333
Hi OG...MINC and MAXC watches a value and captures the min and max it reached until a reset is issued. Not quite what I need, but thanks!!
  Reply With Quote
Old June 18th, 2017, 05:43 PM   #6
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,259
MOV ArrayOfValues[Pointer] to TestValue. Each scan, compare the value to the previously stored MIN/MAX, and if it evaluates as a new min/max, write the value of the pointer into a holding register. Then increment the pointer, rinse and repeat.

Make sure to check whether your pointer has reached the end of your array though, and reset it to zero when it does. Unless PLC major faults are your thing.

You can use a JMP/LBL pair to do all of this in one scan if you wanted - depends on how fast it needs to do the job. Or you could do the same thing with a for...do loop in ST, although I've not done enough ST programming to reliably tell you exactly how it's done
  Reply With Quote
Old June 18th, 2017, 08:40 PM   #7
bluenoser337
Member
Canada

bluenoser337 is offline
 
bluenoser337's Avatar
 
Join Date: Apr 2003
Location: Nova Scotia
Posts: 333
Thanks ASF. I pretty much did exactly what you are suggesting to achieve the same thing in a 5/05 about 10 years ago (with the pointer).
  Reply With Quote
Old June 18th, 2017, 08:56 PM   #8
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,259
Yeah, thought that might be the case. Unfortunately I don't think there are any instructions to do that part of it any easier than it was in an SLC.

Probably the best answer I can give to "how can I do this better in Logix 5000?" is to write a for...do loop in ST, and then wrap it up an an AOI. There's an instruction to do anything in RL5K, just so long as you've got the time to build it
  Reply With Quote
Old June 18th, 2017, 10:17 PM   #9
GaryS
Member
United States

GaryS is offline
 
GaryS's Avatar
 
Join Date: Aug 2003
Location: Lancaster Pa.
Posts: 499
write in in a subprogram 3 or 4 lines of code
then call it when you need the values
Label, jump to label it should only take you a few minutes to write it. I did it a few months ago just as to if it would run no problems
you can save 500 subprograms for later use it's just you don't have the private tags as all memory in public to all programs
  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
Input Min. and Input Max. ddeshi2 LIVE PLC Questions And Answers 19 November 3rd, 2011 03:47 PM
SLC 5/05 Min / Max... bluenoser337 LIVE PLC Questions And Answers 3 April 5th, 2010 09:55 AM
to determine max and min value from DB plc2000 LIVE PLC Questions And Answers 11 June 25th, 2009 02:16 PM
Max and Min values brijacq LIVE PLC Questions And Answers 3 March 4th, 2004 07:03 AM
Mean, max, min values jlra LIVE PLC Questions And Answers 1 October 14th, 2003 04:54 AM


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


.