PLCS.net - Interactive Q & A

PLCS.net - Interactive Q & A (http://www.plctalk.net/qanda/index.php)
-   LIVE PLC Questions And Answers (http://www.plctalk.net/qanda/forumdisplay.php?f=2)
-   -   Need Help with M3/Hour Totalizer (http://www.plctalk.net/qanda/showthread.php?t=113598)

sparkytex January 3rd, 2018 03:43 PM

Need Help with M3/Hour Totalizer
 
Hey everyone,

I need to make a 24 hour totalizer for the total outfall of treated water to the ocean. There is a Flow meter measuring cubes per hour right now and I need to sample it and create a 24 hour totalizer that will start at 12am and run for 24 hours then send a number to the HMI in which I will have the last 7 days displayed. I need the totalizer to reset every 24 hours at 12 am so the operator can log the outfall total cubes every 24 hours at midnight.

I looked at threads involving totalizers but just want some clarification on this since I'm using a flow meter measuring cubes per hour and my brain isn't functioning well right now brain storming this. I'm using RSLogix 5000 to program this with Ladder Logic.

any help is appreciated.

regards,

Tex

sparkytex January 3rd, 2018 03:49 PM

Do I just take the address associated with the m3/Hr flowmeter and divide it by 60 for minutes, then divide by 60 again for a cube per second value, then move it into another floating point address and add it into it self every second using a continuous timer set at .1000?

Bit_Bucket_07 January 3rd, 2018 03:59 PM

Quote:

Originally Posted by sparkytex (Post 763904)
Do I just take the address associated with the m3/Hr flowmeter and divide it by 60 for minutes, then divide by 60 again for a cube per second value, then move it into another floating point address and add it into it self every second using a continuous timer set at .1000?

Pretty much, if the flowmeter input is scaled to Engineering Units, rather than being a raw analog input value. You could simply divide one time by 3600. Run the logic under a 1000 ms continuous task, and you won't even need a timer pulse.

sparkytex January 3rd, 2018 04:03 PM

Quote:

Originally Posted by Bit_Bucket_07 (Post 763905)
Pretty much, if the flowmeter input is scaled to Engineering Units, rather than being a raw analog input value. You could simply divide one time by 3600. Run the logic under a 1000 ms continuous task, and you won't even need a timer pulse.

Thanks for the reply, I guess my biggest question is how to reset the totalized value at 12 am every night so the 24 hour totalized value is reset at midnight each night. I know with RSLogix5 you could use status files to accomplish this, I'm not sure how to accomplish this on RSLogix5000 without using a bunch of timers and counters.

harryting January 3rd, 2018 04:03 PM

It's a math problem, right?

Most people would want to tantalize every second, so you need to covert what unit you have to X unit/second then add it to the total.

If you get X unit/hour, covert it to X unit/second by multiplying it by 1 hour/3600 seconds.

Bit_Bucket_07 January 3rd, 2018 04:04 PM

If you want to avoid rounding errors as your totalizer reaches a large value, then subtract 1000 from your FP totalizer register and add 1 to an integer register every time the FP accumulator is >= 1000, then use a compute function to add the FP totalizer register back to the (INT register x 1000).

Bit_Bucket_07 January 3rd, 2018 04:08 PM

Quote:

Originally Posted by sparkytex (Post 763906)
Thanks for the reply, I guess my biggest question is how to reset the totalized value at 12 am every night so the 24 hour totalized value is reset at midnight each night. I know with RSLogix5 you could use status files to accomplish this, I'm not sure how to accomplish this on RSLogix5000 without using a bunch of timers and counters.

https://www.youtube.com/watch?v=vCrFmo4o7Bs

sparkytex January 3rd, 2018 04:15 PM

Quote:

Originally Posted by Bit_Bucket_07 (Post 763908)
If you want to avoid rounding errors as your totalizer reaches a large value, then subtract 1000 from your FP totalizer register and add 1 to an integer register every time the FP accumulator is >= 1000, then use a compute function to add the FP totalizer register back to the (INT register x 1000).

that average running m3/Hr is only 31 so I don't imagine the FP ever getting above 800 since they rarely introduce more water into the system with their flow control valve.

Bit_Bucket_07 January 3rd, 2018 04:17 PM

Quote:

Originally Posted by sparkytex (Post 763912)
that average running m3/Hr is only 31 so I don't imagine the FP ever getting above 800 since they rarely introduce more water into the system with their flow control valve.

Well then, rounding errors from machine epsilon shouldn't be a concern. It often is a concern when doing totalization.

sparkytex January 3rd, 2018 04:29 PM

Quote:

Originally Posted by Bit_Bucket_07 (Post 763913)
Well then, rounding errors from machine epsilon shouldn't be a concern. It often is a concern when doing totalization.

Yes I could see it becoming a problem with a large number for sure. Thank you!

sparkytex January 3rd, 2018 04:39 PM

Quote:

Originally Posted by Bit_Bucket_07 (Post 763910)

Great Video, thank you for the help it's much appreciated. Happy new year!

sparkytex January 3rd, 2018 05:07 PM

Is there a more accurate way to get the totalizer value? I trended the m3/Hr for half an hour and it never dropped below 30 m3/Hr. I ran a test to see if my totalizer would be close to the average m3/Hr and it was off by quite a bit. For a 30 minute test the totalizer read 13.1 cubes.

Being that the trended m3/Hr shows it never dropping below 30 m3/Hr and ran an average of 31.3 m3/Hr the number over a 30 minute test should be closer to 15.5 cubes. Right now all I have is a continuous running TON timer preset to .1000. That TON timers's .Dn bit is actuating a ONS that's adding the m3/second to itself and storing it as a totalizer value.

Is it the PLC scan time causing this or did I program this wrong?

Edit ** the routine I'm using to house this logic is in a 100ms cyclic task, should I be using a 1 second cyclic task for this totalizer?

cyoung120 January 3rd, 2018 05:20 PM

There is a totalizer instruction in Function Block that works well

sparkytex January 3rd, 2018 05:35 PM

Quote:

Originally Posted by cyoung120 (Post 763929)
There is a totalizer instruction in Function Block that works well

Unfortunately this program is all ladder logic

Bit_Bucket_07 January 3rd, 2018 05:37 PM

Quote:

Originally Posted by sparkytex (Post 763925)
Is there a more accurate way to get the totalizer value? I trended the m3/Hr for half an hour and it never dropped below 30 m3/Hr. I ran a test to see if my totalizer would be close to the average m3/Hr and it was off by quite a bit. For a 30 minute test the totalizer read 13.1 cubes.

Being that the trended m3/Hr shows it never dropping below 30 m3/Hr and ran an average of 31.3 m3/Hr the number over a 30 minute test should be closer to 15.5 cubes. Right now all I have is a continuous running TON timer preset to .1000. That TON timers's .Dn bit is actuating a ONS that's adding the m3/second to itself and storing it as a totalizer value.

Is it the PLC scan time causing this or did I program this wrong?

Edit ** the routine I'm using to house this logic is in a 100ms cyclic task, should I be using a 1 second cyclic task for this totalizer?

Yes, I'd try running the logic in a one second periodic task. That timer pulse will be inherently inaccurate, and you won't need a trigger in a 1 second task. If you have errors after that, I'd re-check the math.


All times are GMT -5. The time now is 12:05 PM.

.