Sign in to follow this  
Followers 0
jmbowles78

Search Function Question?

8 posts in this topic

I have an application involving Q-series PLC communication with a PC controlling multiple AGVs. The AGV control is achieved using an array of data that is passed back and forth using an OPC server. The data pertinent to my question is arranged as follows in the PLC: D0-D29 = AGV Location (D1 = AGV 1 Location, D2 = AGV 2 Location, etc.) D150-D179 = AGV Held (if D151 = 1, AGV 1 is held, if D151 = 0, AGV 1 is not held, if D152 = 1, AGV 2 is held, etc.) For my application, I am controlling a stoplight that changes from green to red when an AGV has just been released from a particular location (location 350). The problem I am running into is that there are 9 AGV's and I would like to avoid using large sections of ladder logic to check the status of each AGV to see if it is held. For reference, only 1 AGV can be reported at a particular location at any time. I have been able to use the SER instruction [sER K350 D1 D1350 K29] to return an integer representing which AGV is at location 350 (the K29 allows for a search total of 29 AGVs for future expansion). For example, let's assume AGV 9 is at location 350. When the SER instruction runs, D1350 returns 9 as the first position that matches 350 (it will be the only searched location that matches, since only 1 AGV can be at that location at any time). At this point I know which AGV is at location 350. What I would like to do is use this information to check and see if AGV 9 is held or not. I know that D159 holds this information. What I can't figure out is how to use my returned value (9) to offset my search location that would start at D150. I've thought about filling a Data Table (FIFW) and trying return only the value I want using FDEL, but I haven't figured out how to easily generate a table from multiple D memory areas. The instruction [FIFW D150 R150] only transfers one data block, and the instruction [FIFW K30D150 R150] is not allowed. Am I even looking in the right direction? Or is what I want to do simply not possible/not worth the effort? I can write the logic that will include all AGVs (if D1350 = 1 and D151 = 0, if D1350 = 2 and D152 = 0), but it seems like there would be a better way. Not to mention there will be multiple stoplight locations and the number of carts may increase in the future. Thanks in advance for any advice.

Share this post


Link to post
Share on other sites
Move your found result to a Z register. Then write D150Z0. If you put 9 in Z0, then this points to D159.

Share this post


Link to post
Share on other sites
Awesome. This looks like exactly what I need (index registers). I'll give it a go and report back with the results. Thanks!

Share this post


Link to post
Share on other sites
In the end this was definitely the solution I was looking for. Many thanks to Crossbow.

Share this post


Link to post
Share on other sites
Doh. It appears that I will need to monitor and control more than 20 locations. From the manuals I've read, it seems that 20 index registers is the maximum for the Universal Q CPUs. Is there any way around this? Just to recap: 1. I constantly search an array of registers reported by the AGV system for the location I am interested in. [sER K100 D0 D1500 K29] 2. The search returns the AGV # at the location in question. I move this number into an index register. [MOV D1500 Z0] 3. I use the AGV # in the index register to send a release signal to the AGV at that location when I am ready. [MOV K1 D150Z0] I am currently using a different index register for each location I am monitoring, but I need to control releases at more than 20 locations. Does anyone see a way around the 20 index register limitation in this situation?

Share this post


Link to post
Share on other sites
Do you need to use them all simultanously or over several scans?? If not, then you can start with saving the existing Z-value to a regular D-register, then move the new value into Z, and after you're done with it you move the original value back into Z.....

Share this post


Link to post
Share on other sites
Thanks for the response. I feel like I need to use them simultaneously (since 2 AGVs can be at different locations at the same time) as well as over several scans (since the release timing can vary based on mechanical movements of loading/unloading equipment, or operator input). I was able to give myself more breathing room by sharing a single index register for 2 locations that I know are mutually exclusive. I can do this in a few places, but I am worried about future expansion possibilities...

Share this post


Link to post
Share on other sites
Is it possible to run FOR-NEXT loops through the collection so that you can re-use the Z in the next FOR-NEXT loop?

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