I work with integrators and we build a production line but line cannot achieve the production goal. we have ABB robot and customer complaint us they can't make enough parts. I am babysitting this line and noticed sometimes robot just wait for the raw part because an operator is not on infeed conveyor to feed the raw parts. I am trying to calculate the robot wait time and need help in designing the database structure.

A line runs 24 hours/6 days a week so I would like to store the robot wait time for each shift separately for next 30 days.

That's what I am thinking about the tag structure.

1. Create one temporary tag.
2. A two-dimensional array of range 30 [0 to 29], Planning to record 30 days robot wait time.

Explanation:- A temporary tag which will store the robot wait time while a robot is ready to pick up raw part but raw conveyor is not ready to unload (This will give me robot wait time) and when the conveyor is ready to unload which means robot will move to pick up a part. Move the record time from temporary tag to 1st element of an array [0,0]. and when the same situation will happen again, add the record time from temporary tag to the first element of an array during the same shift. so At the end of the shift I will have a total time of that shift and then for the next shift of same move the data from temporary tag to array location [0,1] and so on then at the end of 24 hours I will have total wait time of robot for three different shift in single row on particular date for next 30 days.

Important question, How can I move the robot wait time in a different shift of array element? May be get the current day time with GSV and record that current time with robot wait time and set the limit if temporary tag record the "robot wait time" between 7 am to 3 pm then move to that particular location?

Please give me your feed back and Once I design with structure then I will start writing PLC code and if I would need help I hope you guys can advice me.

Note: I am looking for help to give me right direction and not looking for someone to do it for me and I appreciate everyone's time

Thank you

__________________
Junior Control Engineer
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live

Having done this sort of thing it usually easier just to use an array of 32 elements and write the data to the element using the day of month from the wallclock. That way you easily know which day the data is actually from. The FIFO thing is great if you have an arbitrary log length.

Don't try to be too clever for the shift stuff either. Just use three accumulators for each day and use limit instructions to decide which one to increment.

Having done this sort of thing it usually easier just to use an array of 32 elements and write the data to the element using the day of month from the wallclock. That way you easily know which day the data is actually from. The FIFO thing is great if you have an arbitrary log length.

Don't try to be too clever for the shift stuff either. Just use three accumulators for each day and use limit instructions to decide which one to increment.

Initialise each days data when dayofmonth<>olddayofmonth

Thank you for your time!

I think you are right! I shouldn't be too clever about the shift stuff.

Now, I am thinking of creating UDT name "Robot_Wait" with two parameters (Types)
1. Date
2. Shift (robot wait time from 7am to 7am, 24 hours)

Then will create 32 elements of array called Robot_starving[32] (Datatype will be "Robot_wait" (UDT)

Now I will have 32 elements with each element will have two parameters 1.date and 2.shift

Now I am getting my robot wait time from the timer I will use to enable when robot will wait and move that .acc value to my temporary tag and keep adding the time whenever timer enable.

When world clock time will be 7 am, use equ instruction to check its 7am and then move whatever the value in that temporary tag to first element of my array name "robot_starving" and then move 0 to my temporary tag to start calculating for next day from 7am. How's that sound?
But next day How can I move the data to next element of my array? Any suggestion?

Thank you again for the time.

Thank you,

__________________
Junior Control Engineer
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live

The COP([1],[[0]) command is an old trick for shifting data. The only problem is that the oldest stuff is in the lowest registers, while the loading register is higher up.

But one the data shift occurs, the loading register [30] in my earlier example, doesn't change. If you make the array a little bit bigger than it needs to be, and the COP length larger, the "loading register" will get automatically cleared when the COP moves (no) data from register loading+1.

With the UDT, consider having not just .WaitTime but also .WaitCount, maybe even .LongestWait. The more OOE data you collect, the clearer the picture becomes for where your bottlenecks are and how much they're costing you.

If all you want to do is record the waiting time for each day, then there's no need for any confusing shifts, or any other fancy code.

Just use the RTC .Day element (I used a UDT for the RTC data) to record the waiting time into an array big enough to hold a months worth of data. No need for limit checking either, the .Day can only be 1 to 31, so an array of 32 elements is needed.

You could do a bit more math than I have (recording time in seconds, hence the DIV), and do it as minutes or hours, in which case change the array data-type to REAL[32] instead of DINT[32].

EDIT : I'll work on the "working shifts", just re-read the post properly....

Assuming you aren't working on Sundays, you need to account for those dates, so your timer does not increment on those days. So on rung 0 of daba's code, you can check for day ≠11, 18, 25, and 4 if you plan on starting your data collection today.