Sign in to follow this  
Followers 0
mvmalten

PLC-5 Average file only when all values are not 0

4 posts in this topic

Hello, I'd like to calculate an average value of 10 floating points (let's say F180:10 - F180:19), but this average calculation should only occur when all of these floats have a value other than 0. Now, I could of course fill a rung completely with NEQ F180:10 0 NEQ F180:11 0 etc etc, but I don't find this very pretty or efficient. I hope someone can provide me with a better idea, Thanks in advance! Martin

Share this post


Link to post
Share on other sites
I believe this is the only way you could accomplish your goal, especially on a forty years old platform. I really don't see why would you consider this inefficient or "out-of-style"; this is what CPUs are built for afterall....

Share this post


Link to post
Share on other sites
since you are only talking about 10 registers it would be difficult to be efficient or pretty......if you don't like using a bunch of NEQ knock yourself out and write a loop and index thru the registers. You can add them all but if any is zero set or reset a valid bit....its probably no more efficient but its a lot prettier..... bob

Share this post


Link to post
Share on other sites
Yeah I guess you guys are right. I was just thinking that maybe I overlooked a function that would be ideal for it, but I guess not. Thanks for the replies! Martin

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  
Followers 0