sanyc Posted December 1, 2017 Report Share Posted December 1, 2017 So, I have a 4-20 mA analog input and I want to add up the result every (unknown - have to be determined I think) time so that I get the total value. The 4-20 mA signal comes from a weight scale flow controller that reads in T/hr (Tons per hour). By adding that value up I want to obtain the total number of tons that passed so far through the scale. I am using a Unistream 7'' and this is what I came up with so far - which is wrong. What the following does is: it linearizes every second the incoming analog value. A is the analog input. B is X1 = 0 and C is Y1 = 0. D is X2 = 8191 which is the 13-bit resolution of the 0402N module. Then I am adding the result to a memory integer which updates itself. For E, I have Y2 = 60, which comes from linearizing the analog input to Tons/sec. So, how can I implement what I am trying to achieve? Link to comment Share on other sites More sharing options...

MVP 2023 Ausman Posted December 2, 2017 MVP 2023 Report Share Posted December 2, 2017 Hi Sanyc, I'm not into Unistream at all, but to me it looks like you have your maths wrong on this. Y2 at 60 is to my eyes incorrect To convert Tons per hour into a second by second read, you need to be going either of two ways: 1). Every second do the reading, divide this by 3600 (seconds in an hour) and then add this to your accumulation. This method is likely to result in smaller numbers than desirable each addition, dependent on how much material is going through the system, and may not give an accurate result. 2). Every second simply store the raw input number into a large vector of MIs. Progressively bump this along for each read and then when you reach your decided time point do your maths then, based on how many seconds are involved in all the reads. This method would likely be far more accurate due to only using the raw numbers, but will use significant MIs. To save this you could do periodic intermediate calculations, so that you might only have a "60 seconds result" being put into another vector that you then work with for your final calculation. Hope this points you in the right direction. cheers, Aus 1 Link to comment Share on other sites More sharing options...

## Recommended Posts

## 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