Siemens Sorting Routine

jburda

Member
Join Date
Aug 2005
Location
Pennsylvania
Posts
1
I have an application where I read 10 pressure readings from 10 diff pressure transmitters. When commanded to do so, I need to get my values, sort the list based on highest to lowest, and set bits based on which transmitter had the highest reading.

I have developed a function block to do the sorting that is cumbersome and was looking for a better way to do this.
 
If it is just necessary to take action on the highest value just work youre way through the list and remember the location of the highest value. (It is not a lot of data so complex datastructures to speed up the search are unneccacery) I'll give an example in basic.

item_nr=0
largets_found_so_far=0




For nr=1 to Nr_of items
if list[nr]>largest_found_so_far then
largest_found_so_far = list[nr]


Item_nr = nr


end if




next nr



''Action based on highest reading
..
..

What to do with two exactly the same values?

For Siemens you will need to use pointers to make this happen. Or a just make a number of compare's.
 
Last edited:
i did not try it but i would think in this way


  • create a table in a data block
  • put the first reading in the table using att function from the ti lib
  • for the rest of the readings use the cdt function to locate the first value equal than or grater than the reading (2-10)
  • if the returned index value is within the table then this value is grater than the values in the table , in this case use the function iblokmov to move the table down , then add the value in the empty space (u need to use indirect addressing to locate it)
  • if the return value is not within the table then add the value to the table using att
it is pretty complicated , please send me the result if u success in this way or another
 

Similar Topics

The past week we received a new piece of equipment from Germany which utilizes siemens controls. Typically in our company we use A.B. controls for...
Replies
6
Views
117
Hello I have a s7-1200 and I would like to read the tags present in this controller with my controllogix controller. The two controllers don't use...
Replies
5
Views
134
Hi need help why this “failure 5 emergency stop “ appears at every startup in the morning ? Have to shut off main switch at least 10 times on...
Replies
19
Views
296
i have two plc 1. s7-1212dc/dc/dc ip; 192.168.0.1 2. s7-1500 1513-1pn ip; 192.168.3.2 i need to get data from plc1 to plc2. any idea how to do...
Replies
5
Views
109
Hi everyone hope you'll well. Is it possible for me to download a Crack version of tia portal v13..sorry to say this but the software is very...
Replies
5
Views
198
Back
Top Bottom