Jump to content
Sign in to follow this  
Vprakatoor

PLC not calculating totals properly

Recommended Posts

HI everyone. I have a Unitronics PLC with HMI USP-104-B10

I have a Flow meter connected to one of the Analog input cards and it sends out a flow rate, I want to calculate the total flow in cubic meters and display it on the HMI, I also want another display with Weekly Flow ( so it uses the same logic and calculations of the total flow but should reset every time the operator pushes a reset button after he takes his readings).

 

Both The Calculations are the Exact same logic the difference is they are assigned to different tags. But the readings are completely different and random.

 

UNISample.PNG

Share this post


Link to post
Share on other sites

And note the edit after this original lot which I've changed to italics!!   And as well as Joe's comment, and perhaps related to your issue, your descriptions describe the flow meter 1 output as M/Hr.  If it is indeed giving you an instant reading of cubic metres per hour, then why is there a 3600 involved in your calculations?  If the reading is M³/Hr, then even though you are doing it once a second you don't want to be multiplying it by 3600 to turn it into an hourly rate.  It already is.   And it might result in the different readings.

Edit additions:  You know how some mornings all your brain cells are firing off fantastically and that horrible problem programming issue gets resolved in a flash?  Well...this morning wasn't one of them (  ⚠️  ) and I wrote some odd things!  However, this question tumbled around in my head on and off all day, and I realised that I was partly on the right track....I probably hadn't had enough coffee.  And it was a Saturday morning.  And it was hot.  And anything else I can use as an excuse.

It needs to be broken down into the sequence.  The sequence you have is, to my eye, incorrect.

The M³/hr is read every second, that reading needs to be divided by 3600, the result of this division is added to both the full accumulated total and your weekly total, and nothing further needs to be done to it.  At your weekly button push, the weekly total is simply reset to 0 and that count starts again.   You will also have to ensure that the system's operands in use can cope with the different number ranges needed.

Me writing this now will (hopefully) let my brain sleep properly tonight!

cheers,

Aus

 

Share this post


Link to post
Share on other sites

Thank you so much for the responses  and sorry for my late reply, for some reason I got no notification of replies to my thread.

Joe,
I have attached my entire program. 

Ausman,
From what I understand that the sequences may be incorrect but they are the exact same logic with the exact same sequence for total and weekly, why are the readings different for both of them?


Thank you guys once again for taking the time.

Regards,
Vijay

Share this post


Link to post
Share on other sites
1 hour ago, Vprakatoor said:

why are the readings different for both of them?

Because you  are applying incorrectly sequenced maths to separate totals, resulting in different amounts?

cheers, Aus

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
Sign in to follow this  

×