Jump to content

Formula block ignoring calculus


Recommended Posts

Hi everyone,

I'm trying to make formula block works, the formula is ( 685 - ( ( 777 / 10000 ) * A ) ) = MI 12,  where A is MI.

This keeps me giving me 675 as result. Doesn't matter the A value.

I tried also to work with "0.0777" and "0,0777", and changed the MI's to ML's but I didn't get the right result.

Thanks

Link to comment
Share on other sites

  • MVP 2023

PLCs don't do floating point very well if integer data types (MIs) are part of the considered equation.  Your 777/10000 term and your decimals are less than 1 and getting thrown out when the formula block executes.

If you want decimal points do everything in MF data types and build your formula out manually.

Joe T.

Link to comment
Share on other sites

  • MVP 2023
19 minutes ago, Joe Tauser said:

If you want decimal points do everything in MF data types and build your formula out manually.

Or do some math ahead of the formula block to ensure any division results with integers are greater than 1 and big enough to provide the needed precision. Then you can sort out the decimal location afterward.

Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.