how to store timer.acc VALUE

backendcode

Member
Join Date
Aug 2017
Location
brampton
Posts
249
Hello Everyone,
This might be a very stupid question but I need help to store the accumulator value before it resets.

So I am doing time study application and When part will come on the proximity sensor of my conveyor, it will store the date and time so I am using GSV instruction. at the same time, I also need to know how long part stayed there so I am using the timer and my accumulator value will give that time. So when I accumulator start increasing and I move that value to another tag(variable) DINT but when my time stops timing or condition become false before the timer, it resets the .acc value as well as the value of variable where I am moving my .acc value.

How Can I store the value to .acc everytime it increases!

I attached the pic and link of my code

https://ibb.co/kk6Kdk

Thanks

time-study.jpg
 
The simplest thing would be to use an Rententive Timer On (RTO) instruction.

Those instructions retain the .ACC even if the preceding rung conditions go false.

You would then need to add a Reset (RES) instruction in series with that GSV, to Reset the timer each time the input condition went from false to true.
 
The simplest thing would be to use an Rententive Timer On (RTO) instruction.

Those instructions retain the .ACC even if the preceding rung conditions go false.

You would then need to add a Reset (RES) instruction in series with that GSV, to Reset the timer each time the input condition went from false to true.

Thank you for the advice but I follow this method and what you think?

https://ibb.co/jRgXW5
 
You could also put the move in parallel with the timer, so it only moves while the timer is timing.

Edit

Assuming you don't want the max for all parts
 
You could also put the move in parallel with the timer, so it only moves while the timer is timing.

Edit

Assuming you don't want the max for all parts

This is what I was thinking. Put a normally open .TT bit to trigger the move.
 
backendcode said:
...How Can I store the value to .acc everytime it increases!...

spaderkung said:
Move only when your current value is greater than the previous.

backendcode said:
It worked this way!!...

Did you mean...

Store the timer acc value each time it increases above zero?
(Stores last timer acc value)

...Or...

Store the timer acc value each time it increases above its previous maximum value?
(Stores only the maximum timer acc value)

From your last post and screenshot it would appear that you meant the former and are now happy with the result.

But what spaderkung was advising is, I think, intended to achieve the latter - evaluate if the current timer acc value is greater than the previous timer acc value and only move the timer acc value if it evaluates true. This will only move the timer acc value when it is greater than the currently stored maximum timer acc value.

Storing the maximum duration that an event is true for, such as a part sensor, is a quite commonly implemented task. It's often used to monitor for a maximum event duration when commissioning or fault finding or when initially setting watchdog timer presets. So I just wanted us to be clear on what exactly it is you hoped to achieve by storing/studying the timer acc value per part.

You could of course do both. For each event store the timer acc value in <door_stayed> and also evaluate for and store the maximum timer acc value in another DINT tag. Example: <door_stayed_max>. This way you could always see the last duration and the currently stored maximum duration.

Also, your current logic, using greater than "0", will only store the last precondition true timer acc value in your destination DINT during the interval before the next precondition true event. If you just want to be able to manually view it in the software as it happens or after the last event, or you are using each current value elsewhere before the next event overwrites it, then that may be fine. But if you do need some amount of historical or statistical data points, then I would suggest you create a suitably sized DINT array and move each successive value to the array using indirect addressing and a rolling pointer. Once the pointer reaches the end of the array it will rollover and start overwriting from the beginning again. Say you have a DINT[100] array. Once fully populated you would have the timer acc value for the last 100 events at any one point in time. You could sum the array values and calculate the average, minimum, maximum, etc. All sorts of studying could be done.

I'm sorry that I'm not near software at the moment to provide an example or two.

If you are happy then I am happy. That was just some food for thought. Whatever it is you'd like to achieve here, you will find, as is often the case, that there are many ways to reach your destination.

That's the art of programming. Each artist has their own canvas, brush and stroke, and of course, critics.

Regards,
George
 
Did you mean...

Store the timer acc value each time it increases above zero?
(Stores last timer acc value)

...Or...

Store the timer acc value each time it increases above its previous maximum value?
(Stores only the maximum timer acc value)

From your last post and screenshot it would appear that you meant the former and are now happy with the result.

But what spaderkung was advising is, I think, intended to achieve the latter - evaluate if the current timer acc value is greater than the previous timer acc value and only move the timer acc value if it evaluates true. This will only move the timer acc value when it is greater than the currently stored maximum timer acc value.

Storing the maximum duration that an event is true for, such as a part sensor, is a quite commonly implemented task. It's often used to monitor for a maximum event duration when commissioning or fault finding or when initially setting watchdog timer presets. So I just wanted us to be clear on what exactly it is you hoped to achieve by storing/studying the timer acc value per part.

You could of course do both. For each event store the timer acc value in <door_stayed> and also evaluate for and store the maximum timer acc value in another DINT tag. Example: <door_stayed_max>. This way you could always see the last duration and the currently stored maximum duration.

Also, your current logic, using greater than "0", will only store the last precondition true timer acc value in your destination DINT during the interval before the next precondition true event. If you just want to be able to manually view it in the software as it happens or after the last event, or you are using each current value elsewhere before the next event overwrites it, then that may be fine. But if you do need some amount of historical or statistical data points, then I would suggest you create a suitably sized DINT array and move each successive value to the array using indirect addressing and a rolling pointer. Once the pointer reaches the end of the array it will rollover and start overwriting from the beginning again. Say you have a DINT[100] array. Once fully populated you would have the timer acc value for the last 100 events at any one point in time. You could sum the array values and calculate the average, minimum, maximum, etc. All sorts of studying could be done.

I'm sorry that I'm not near software at the moment to provide an example or two.

If you are happy then I am happy. That was just some food for thought. Whatever it is you'd like to achieve here, you will find, as is often the case, that there are many ways to reach your destination.

That's the art of programming. Each artist has their own canvas, brush and stroke, and of course, critics.

Regards,
George

George,

Thank you so much for writing and taking very close look at my thread! So here is the situation and what I am trying to achieve!

I am working on conveyor project called" Inspection line" or "inspection conveyor". There will be a guy who works at the end of the production line and once he will finish the product (My company makes a metal door), he will feed the door on inspection line, on conveyor 1. The inspection line has 6 conveyors controlled by individual motor and prox which mean at one time, he can feed up to 6 doors occupied by each conveyor. The conveyor 6 will be offload station where the another worker will inspect the door and take off from the inspection line.
Now every time, when door will come and sit on conveyor 6, I want to know how long door stayed at conveyor six and record that time because this time will help me to calculate the inspection time spent by worker on each door. I want to record the data with timestamp. Lets say first door came at conveyor six, I will record what time and day door came and how long it stayed and record that information and later on I am planning to store this information in the excel file or SQL server and display that data on web page where my production manage can see that data with historical data as well.


I hope that clears your point you mentionted!

Thanks again!
 
Ok, that's a lot clearer thanks.

You'll definitely want to be storing each timer acc value along with the time stamp in an array, ready to push out for live and historical data acquisition. How far you'll want to go back will determine your array size. It is also possibly to push the data out for acquisition immediately and not use controller arrays.

You could also consider using a FIFO and track the products on the 6 conveyors. You could assign a meaningful reference for each product that is stored along with the other data so as to provide a look up reference as to which specific product took a certain amount of time to be inspected.

You could also create an inspection pass/fail signal (push buttons) for the operator to flag the product status before removal. That way you could also reference whether an irregular inspection period was due to a defect or it was a good inspection that just took too long. This simple signal can also allow you to derive product failure rates. Of course, that is if ye are not already doing something similar.

Lots of little things you can do to gather more statistical data. This sounds very much like an efficiency improvement task.

G.
 
Ok, that's a lot clearer thanks.

You'll definitely want to be storing each timer acc value along with the time stamp in an array, ready to push out for live and historical data acquisition. How far you'll want to go back will determine your array size. It is also possibly to push the data out for acquisition immediately and not use controller arrays.

You could also consider using a FIFO and track the products on the 6 conveyors. You could assign a meaningful reference for each product that is stored along with the other data so as to provide a look up reference as to which specific product took a certain amount of time to be inspected.

You could also create an inspection pass/fail signal (push buttons) for the operator to flag the product status before removal. That way you could also reference whether an irregular inspection period was due to a defect or it was a good inspection that just took too long. This simple signal can also allow you to derive product failure rates. Of course, that is if ye are not already doing something similar.

Lots of little things you can do to gather more statistical data. This sounds very much like an efficiency improvement task.

G.

Awesome, Thank you for the recommendation of using FIFO. I am pretty new to PLC programming and I will definitely look into it and try to write a code. Is that ok if I can PM my email address and once I finish the PLC code so you can look into that? I would appreciate that

Thanks again!
 

Similar Topics

I'm running into a problem when trying to use the RSLinx Backup Restore Utility where it throws an error when it tries to restore a backup. The...
Replies
6
Views
543
Hi y'all I have a KTP400 connected to a s7-1200. Now i have on my screen the encoder value which comes from my SEW movitrac. under there I have...
Replies
2
Views
381
This was asked in another forum and taken down due to being a 'backdoor', but this has useful info that might be useful to someone in a pinch. I'm...
Replies
6
Views
604
Hello all, I'm using a 5069-L330ER in a project and I need to essentially capture some data that will be shown as a trend on a screen. The data...
Replies
9
Views
959
Back
Top Bottom