Sign in to follow this  
Followers 0
Dale

Runtime accumulation

4 posts in this topic

I am using a MicroLogix 1500 and am trying to compare 4 runtime accumulation registers with each other and sort them per value. During operation the one with the lowest value needs to turn on first, next lowest turn on next ect. Does anyone have any suggestions for a simple compare? I need something streamline because I have to replicate this 10 times.

Share this post


Link to post
Share on other sites
I think I could help, but I can't grasp your application, can you post the code or explain a little bit more?

Share this post


Link to post
Share on other sites
I should have been more specific. Through code I am accumulating the amount of time 4 lighting contactors are on. These values are stored in floating point register. At a specific period of time I need to do a compare of the 4 accumulated values and turn on the contactor with the fewest amount of on time. At the next period of time turn on the next lowest amount of on time and so on. And when it is time to turn off a contactor, reverse the scenario, the one with the largest amount of on time turns off first. I have attempted to do a bubble sort but for some reason have run into difficulties. I am trying to streamline the logic to make it easier to duplicate over 10 groups of 4 lighting contactors. Hopefully this clarifies the app. Your advice is greatly appreciated.

Share this post


Link to post
Share on other sites
If you have problem to program bubble sort, you may program subrutine, which will look for the lowest value in the F8:1, F8:2, F8:3, F8:4 registers (not bubble sort- just lowest value) and assign value to integer word N7:0 equal to the number of register 1, 2, 3, or 4.  Every time you need turn ON contactor from any group(by time interval, sensor, switch) call this subrutine and pass addresses of the registers as parameters. Subrutine will return value of N7:0 as number of the register with the lowest value.  Use this value in the indirect addressing to turn ON corresponding output. Do the same thing to get register with the highest value to turn corresponding output OFF. I hope it helps. Regards, Paul Bronshteyn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0