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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...