jmbowles78

CJ2M-CPU34 Function Block Timing Question

2 posts in this topic

I'm working on an AGV control system that interfaces with PC software that controls some AGVs (currently 15, up to 20 max).  The interface between my CJ2M-CPU34 and the AGV Control PC is OPC based (Kepware).

Specifically, the AGV Control PC provides me information regarding each AGV (current location, target destination, etc.).  In this system, it is my responsibility to test when a PLC reaches a location, then send it a new destination once system conditions merit a release.  This release responsibility occurs at several points in the system (probably around 50).

At the moment, I'm using some function blocks to determine:

A)  When an AGV has arrived at a location

B)  When an AGV has a particular destination

I have one function block instance per location, and per destination that I am checking for.  These function blocks have FOR/NEXT loops that search the Location or Destination array to see which AGV (if any) match the search criteria.  The function block then returns the AGV number and I can use that as a pointer to instruct a specific AGV where to go next.  I'm currently running each function block as a rising edge trigger on a 1.0 second clock pulse bit (CF102) to get udpates once per second (the FOR NEXT loop will complete before the scan can finish, as I understand things).

The problem I'm running into is that while my average cycle time is about 2.3 ms, the maximum cycle time approaches 10 ms or more.  I believe this occurs on the scan where all of the function block searches are triggered (since they all fire off of the same CF102 rising edge).  As the program has grown, online editing and other functions have slowed down and I'm worried that as I complete the system it will become less and less responsive.

Is there a more clever or efficient way I should be monitoring these registers?  Should I stagger my function block trigger timings or will that make no overall difference?  Do I just need to upgrade to a CJ2H CPU and beat the problem over the head with a hammer?

Any insight would be greatly appreciated.

Thanks,

Jason

Share this post


Link to post
Share on other sites

Jason,

When I have had to program extensive for next loops, I wrote the code in a way that it only did a portion of the loops during a scan.  For a simplified example, lets say that I had to do 100 loops, I might run loops 1-10 one scan, then 11-20, then 21-30 ... then 91-100.  This breaks up the load on the controller and will result in less of an increase in your scan time.

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