Batching Average

kandersen

Member
Join Date
Mar 2017
Location
sc
Posts
1
I have an application using control logix 5000 version 11.25. Yes I know that is old, and no I can't upgrade it right now. I am trying to build a moving hour average of the weight number for each batch. I have used MAVEs in the past, but I am stumped how to make it work in this application.

So basically if I have 37 batches in an hour I need to add them up, divide by the number to get my desired number. But with the number of batches varying I am stumped how to get what I want.

Can I use a trigger for a mave to only grab a single point each time the batch dumps and it keep a rolling average for the hour?

An example of the logic of how to do this would be awesome!

Thanks!

Kevin
 
Welcome to the forum!

I'd approach it this way...

This method assumes you can have no more than one batch per minute. If that's not the case, you can still use the same theory, but will have to tweak it and make it a bit more complex to make it work...

1. Create an array of DINT's/REAL's, array size 60. Let's call it Batch_History

2. Every time a batch completes, store it's result in a holding register. Let's call it Last_Batch

3. Create a one minute pulse

4. Create an FFL/FFU pair to operate on your Batch_History array

5. Each time your one minute pulse ticks over, do the following:
a. Check if your array is full (which, after the first hour, it always will be) - i.e. check if the .DN bit is on. If so, perform an FFU on the array, which will unload the data from 60 minutes ago. If not, or once you've done the FFU, proceed to...
b. Perform an FFL to load Last_Batch into the Batch_History array
c. Reset the Last_Batch tag to zero

6. Now, you have an array of figures with all batches from the last hour. Of course, if batches take more than exactly one minute to prepare, you'll also have a heap of zeroes. We can probably safely assume that a zero is just an indication of "no batch performed in this particular minute", so the zeroes can be ignored. So, to move on to...

7. Create another array of DINT's/REAL's of length 60. Let's call it Averaging_Array

8. Each minute, after your FFU/FFL of your batch weight is done, code a bit of a loop which uses another FFL, or just indirect addressing and a pointer, to load all non-zero values from Batch_History to Averaging_Array

9. Once you've got all your non-zero values, perform an AVE instruction on the Averaging_Array. Set the .LEN of the AVE instruction to the .POS of your FFL or your Pointer value, depending on how you approached step 8

10. Once you've worked out your average, clear out the averaging array to all zeroes, and reset your pointer/FFL/FFU as necessary to prepare for the next round

11. Profit!
 
Brute Force Method

Here is a way using the Brute Force Method to get an average. It uses a FAL to add weight to an Array. Timestamps the first batch to know when the hour has completed and resets the FAL and the TimeStamp. The Excel Sheet contains the logic. I was not sure if 11.25 would import a subroutine. The Yellow highlighted rows are the comments. If you copy and paste the row logic into a program it will create the rungs. Do not copy the rung comments with the logic or you'll get unknown instructions for the comments.

The Array is DINT[60]
The Index is DINT[2]
Local Time and Timestamp are DINT[7]
 
Last edited:

Similar Topics

Just a little bored, so I thought I would start a thread in one way of using recipes in batching processes, I'm aware there are probably many ways...
Replies
0
Views
588
Could someone provide some more information on the batching feature in Crimson 3.0? I have a PTV connected to multiple micro820s that I would like...
Replies
2
Views
1,765
Hi, Just need help with implementing a logic that will help me keep track of the amount of water an operator requests during his batching...
Replies
3
Views
1,458
Hi I have been asked to configure differential batching. I have 2 pulse flowmeters either side of a valve. The ide is when the valve is open i...
Replies
0
Views
2,237
Hi, check one of my project on batching system (PLC+HMI) https://www.youtube.com/watch?v=7KktkU1lNwM Thanks
Replies
0
Views
1,224
Back
Top Bottom