Jump to content

Recommended Posts

Hi,

You will eliminate to use Float Point at all.

Use Linearization Function (see Help for details).

When X is Input, and Y is Output, linearization formula is:

Y=((Ymax-Ymin)/(Xmax-Xmin))*(X-Xmin)+Ymin.

When You replace Ymin and Xmin by 0, formula looks much more simple:

Y=(Ymax/Xmax)*X

For your case:

Ymax=1050, Xmax=1270, X=132, Y=109.

If you need 1 digit after decimal point - use 10 multiplier for Ymax. When Ymax=10500, Y=1091.

Then display Y with 1 decimal digit.

Believe this fit your needs.

BR.

post-5711-0-30222300-1341735340_thumb.gi

Share this post


Link to post
Share on other sites

I attempted to attach a program file and was not able to do so....not sure what that was about. But one note of caution. Since there is no floating ability in the M90/91 you lose the remainder entirely regardles os wheather or not the remainer was a 1 or a 9. For example with one decimal in your specific example you will get 109.0 even though the actual answer should be 109.1. if you go out two decimals instead on one you will get 109.09. If you did this calculation floating then you would get a more accurate number of 109.13. The question is how accurate do you need to be?

If you must show the more accurate answer of 109.1 then you are going to have to capture the remainder and do a comparison to decide if you want to round up or down on any calculation made. If you need the even more accurate 109.133 type number then you will most likely have to change PLCs from what you are using to a model that has flaoting point ability (the V120 or V130 are the lowest cost models with float ability).

Also the linearization function only works using signed MI type locations so the maximum number you can have is 32767. So be careful trying to multiply by larger and larger numbers to get more decimal locations because you will end up with a number that is larger than 32767 and the linearization block will no longer work. If you must work with number larger than 32767 then there is a special SB82 bit that will allow you to combine 2 integers (called the long integer in the description for SB82). The use of SB82 has several special requirements so look in the forums and examples to get it correct if you decide you must use it.

Keith

Share this post


Link to post
Share on other sites

Or you could just start over with a V130 and use floating points. The Jazz/M90 Wall strikes again. The amount of time spent trying to use a pliers where you need a socket wrench can really add up.

Joe T.

Share this post


Link to post
Share on other sites

SI4 automatically catches the divide remainder.

I have certinaly hit this wall also. Trying to hold the middle ground between overflow on large numbers and rounding errors on small numbers can be a real juggle.

If you just need to file a new edge onto your pliers to use them as a socket wrench then it's not so bad, if all you have is pliers. If you find you are melting down the pliers to cast them in to the shape of a socket wrench then it has probably gone too far...

Share this post


Link to post
Share on other sites

Keith, you should be able to upload a program--please try again, and pm me if you have problems.

There was a recent update of the forum platform and some resultant weird stuff happened...

>If you find you are melting down the pliers to cast them in to the shape of a socket wrench then it has probably gone too far...<

At that point, apply sledgehammer... :P

Although I find some of the workarounds people come up with to be amazing.

Share this post


Link to post
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...