Haas parametric programming (floating point) help


Results 1 to 13 of 13

Thread: Haas parametric programming (floating point) help

  1. #1
    Registered
    Join Date
    Jan 2018
    Location
    United States
    Posts
    7
    Downloads
    0
    Uploads
    0

    Question Haas parametric programming (floating point) help

    I am building a macro (to run on a CHC) to log serial numbers and operator IDs for later database query at a relatively large foundry.

    Our Serial format is nonconsecutive as follows

    123A

    I am using a line of code to concatenate several (manual) operator entries into a single string where:
    #500-#503 are numerical digits
    #504 is an alpha character
    #805 is the numerical translation of the serial number

    #805=[[ROUND[[[[#500-48]*100]+[[#501-48]*10]+[#502-48]+[[#503-64]/100]]*100]]/100]

    The trouble that I am having is that the final digit, which should always read in increments of 0.01 is plagued with what appears to be a floating point error. The effort towards placing the numerical value and the alpha value into a single variable is in hopes that the operator can verify the value and reenter as necessary.

    This seems to be an extremely simple task, but I've put the above line together numerous ways, always to be plagued with a similar error.

    Any suggestions?

    Similar Threads:
    Attached Files Attached Files


  2. #2
    Member
    Join Date
    Feb 2012
    Location
    USA
    Posts
    115
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    Do you have any computer programming experience? You need to separate all those into steps and figure out where it goes wrong. It could be an overflow somewhere. Also, floating point loses precision with large numbers as well.



  3. #3
    Registered
    Join Date
    Jan 2018
    Location
    United States
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    I don't have any programming experience beyond g code and very basic PLC work.

    I do know, however, that the error originates in the
    [[#503-64]/100] operation


    Sent from my Pixel 2 using Tapatalk



  4. #4
    Member
    Join Date
    Feb 2012
    Location
    USA
    Posts
    115
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    Do you know the approximate values before and after for that step? And what is the desired value?



  5. #5
    Registered
    Join Date
    Jan 2018
    Location
    United States
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    The value changes based upon operator inputs.

    Typically the numerical portion is less than 200, and the alpha input is A, B, C or D.

    If I am understanding your previous response correctly, you are suggesting g that I concatenate at

    VALUE * 10^N

    and in a separate operation, divide by 10^(N+2) in order to restore the desired decimal location.

    In this case, doe Haas treat division and multiplication by less than one on the same way?

    Sent from my Pixel 2 using Tapatalk



  6. #6
    Member
    Join Date
    Feb 2012
    Location
    USA
    Posts
    115
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    What I am trying to say is that it isn't really a haas limitation, but rather likely the a math float type limitation. You need to figure out where and why this happens and reformulate your formula. That's why I suggest splitting it all out into single steps, that way you can single step through your code and watch the actual values as it gets calculated in the macro param window.



  7. #7
    Member
    Join Date
    Feb 2012
    Location
    USA
    Posts
    115
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    I don't understand what you are doing well enough to give ideas. I do think there is a pow option in the macros though.



  8. #8
    Registered
    Join Date
    Jan 2018
    Location
    United States
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    Sorry, pow option?

    Sent from my Pixel 2 using Tapatalk



  9. #9
    Member
    Join Date
    Feb 2012
    Location
    USA
    Posts
    115
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    Power



  10. #10
    Member
    Join Date
    Feb 2012
    Location
    USA
    Posts
    115
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    What is your desired output, anyway? Also, I think you perhaps said wrong, #503 = the alphanumeric. If I understand your problem you want the alpha to be the decimal.

    Perhaps
    #805=[[#500-48]*100]+[[#501-48]*10]+[#502-48]+[[#503-64]/100]

    I think this would output

    123.01 for 123A
    123.26 for 123Z

    Last edited by erikfriesen; 01-03-2018 at 09:53 AM. Reason: Changed to 10 to 100


  11. #11
    Registered
    Join Date
    Jan 2018
    Location
    United States
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    Quote Originally Posted by erikfriesen View Post
    What is your desired output, anyway? Also, I think you perhaps said wrong, #503 = the alphanumeric. If I understand your problem you want the alpha to be the decimal.

    Perhaps
    #805=[[#500-48]*100]+[[#501-48]*10]+[#502-48]+[[#503-64]/100]

    I think this would output

    123.01 for 123A
    123.26 for 123Z
    This is absolutely correct, however, the value returned is

    123.01 for 123A but
    123.01999999... for 123B

    I will try your specific line shortly as well as the FUP operator.

    Sent from my Pixel 2 using Tapatalk



  12. #12
    Member
    Join Date
    Feb 2012
    Location
    USA
    Posts
    115
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    Ok, Perhaps round on the last? the .01999 is definitely caused by floating point math, unfortunately. You could try something like [[[#503-64]+0.00001]/100] or ROUND[[#503-64]/100]



  13. #13
    Member
    Join Date
    Nov 2006
    Location
    US
    Posts
    490
    Downloads
    0
    Uploads
    0

    Default Re: Haas parametric programming (floating point) help

    What about the "FIX" macro command? If I remember correctly that will dump out the trailing remainder numbers and give you a value that has been "rounded down". I never used it outside of the probing macros though, so it may not do what you need...



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Haas parametric programming (floating point) help

Haas parametric programming (floating point) help