Torque skip peck drilling cycle macro?
Close
Login to Your Account
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2021
    Country
    UNITED STATES
    State/Province
    Utah
    Posts
    9
    Post Thanks / Like
    Likes (Given)
    18
    Likes (Received)
    2

    Default Torque skip peck drilling cycle macro?

    Let me start by apologizing for my love affair with, and possible overuse of, macros.

    I am trying to add a chip breaking peck to a drilling process that is also using G31 torque skip for load monitoring. I wrote up a process for it that sets all the key values with macros so it is easy for me to play with all the information right in one place. It uses a do-while loop until it gets within one peck of the final depth, then exits the loop and completes a move to the final position. After each move it uses logic to test if it reached its target, and if at any point it has not then it jumps to a message for the operator. When I dry run in it on my Fanuc 31i-MODEL b, it makes it through the do-while loop a few times, but then fails before it arrives to the final target location. It seems to fail on the first IF statement. I cannot seem to find a programming error, but I suspect there must be one. If you can find a problem or have a more elegant solution I would love to learn from you.


    #140=-.1 (DRILL Z START POS)
    #141=1.8 (DRILL FINAL Z DEPTH)
    #142=.02 (DRILL PECK INCREMENT)
    #143=.002 (DRILL RETRACT INCREMENT)
    #145=155 (TORQUE PERCENTAGE LIMIT. NO DECIMAL)
    G0 Z#140
    WHILE[#140LT[#141-#142]]DO1
    #140=#140+#142 (SET PECK Z TARGET)
    G31P98Q#145Z#140F.0055 (FEED TO Z TARGET WHILE)
    (MONITORING TORQUE LOAD ON FEED AXIS)
    IF[#5042NE#140]GOTO234 (IF TORQUE LIMIT WAS)
    (EXCEEDED BEFORE REACHING TARGET THEN SKIP)
    (RETRACT AND EXIT DO-WHILE LOOP)
    G1 W-#143
    GOTO345 (CONTINUE WITH DO-WHILE LOOP)
    N234 (FORCE EXIT FROM DO-WHILE LOOP)
    #140=#141 (FORCE EXIT FROM DO-WHILE LOOP)
    N345
    END1
    IF[#140EQ#141]GOTO456 (IF TORQUE LIMIT WAS)
    (EXCEEDED BEFORE REACHING PECK TARGET THEN)
    (#140 WAS SET TO MATCH #141 AND THIS WILL SEND)
    (PROGRAM DOWN TO RETRACT/ALARM CODE)
    G31P98Q#145Z#141F.0055 (FINISH DRILL TO DEPTH)
    IF[#5042NE#141]GOTO456 (IF FINAL Z WAS NOT REACHED)
    (THEN SKIP DOWN TO RETRACT MOVE AND ALARM)


    N456
    G0Z-.200
    M283 (HP COOLANT THRU OFF)
    M5
    M505
    #3000=1(T22 DRILL OVERLOADED. CHECK TOOL CONDITION)

  2. #2
    Join Date
    Dec 2011
    Country
    UNITED STATES
    State/Province
    Illinois
    Posts
    395
    Post Thanks / Like
    Likes (Given)
    91
    Likes (Received)
    115

    Default

    I looked over the code and don't see any obvious errors. What do you mean that it fails? Fails how? Overloads? You already had the torque skip working and are just now trying to add the pecking? Will the program cycle through if you replace your G31 lines with normal G01 lines? Maybe you need to add some dwells before and after your peck retracts? Or maybe you need to inhibit buffering before running this macro?

  3. Likes reddman liked this post
  4. #3
    Join Date
    Feb 2021
    Country
    UNITED STATES
    State/Province
    Utah
    Posts
    9
    Post Thanks / Like
    Likes (Given)
    18
    Likes (Received)
    2

    Default

    Thanks for the response wmpy.

    On the first IF test, where it verifies that it made it to the commanded position, it fails about the third time through the DO-WHILE loop, meaning that the first few times it asked if it made it to that position it successfully verifies that it made it, and the third time around it says it did not. I was dry running it on an empty tool position so I know it isn't actual tool load making it fail to get to the commanded position. I was reading elsewhere and am now wondering if it is a rounding problem. I have not had opportunity to test that yet as I am not yet sure how to round the values in a way that will give me the desired results (ideally I think lopping off the final digit would do it, but not sure how to do that yet).

    I did already have the torque skip and IF statement verification working on this machine, and just added this chip break peck to alleviate a chip buildup issue that causes problems occasionally. That is a good idea to swap the G31 for G1 to narrow down the problem. I will check that out, and I'll test out the buffering prohibit idea. Being that it makes it through a few times before failing the positioning validation IF statement I don't imagine a dwell is going to have an effect, plus I really don't want to fully pull the carbide drill from the cut or subject the tool to a dwell while engaged.

  5. #4
    Join Date
    Feb 2021
    Country
    UNITED STATES
    State/Province
    Utah
    Posts
    9
    Post Thanks / Like
    Likes (Given)
    18
    Likes (Received)
    2

    Default

    A coworker just had a great idea when I asked him about how to round by only reducing the precision, not going up or down (i.e. lopping off the final digit in the decimal). If I add an acceptable range of imprecision with a statement like: IF[[#5024LT[#140+#146]]AND[#5024GT[#140-#146]]]THEN#140=#141

    This also creates a more elegant exit from the do-while loop by eliminating the GOTO345 and a couple other lines of code. Reworked with the imprecision tolerance the code now reads as shown below, and while I have not yet verified it I do feel pretty confident about it. I will test and report back after.

    #140=-.1 (DRILL Z START POS)
    #141=1.8 (DRILL FINAL Z DEPTH)
    #142=.02 (DRILL PECK INCREMENT)
    #143=.002 (DRILL RETRACT INCREMENT)
    #145=155 (TORQUE PERCENTAGE LIMIT. NO DECIMAL)
    #146=.0001 (TOLERANCE FOR IMPRECISION)
    G0 Z#140
    WHILE[#140LT[#141-#142]]DO1
    #140=#140+#142 (SET PECK Z TARGET)
    G31P98Q#145Z#140F.0055 (FEED TO Z TARGET WHILE)
    (MONITORING TORQUE LOAD ON FEED AXIS)
    IF[[#5024LT[#140+#146]]AND[#5024GT[#140-#146]]]THEN#140=#141
    (IF TORQUE LIMIT WAS)
    (EXCEEDED BEFORE REACHING TARGET THEN SKIP)
    (RETRACT AND EXIT DO-WHILE LOOP)
    G1 W-#143
    END1
    IF[#140EQ#141]GOTO456 (IF TORQUE LIMIT WAS)
    (EXCEEDED BEFORE REACHING PECK TARGET THEN)
    (#140 WAS SET TO MATCH #141 AND THIS WILL SEND)
    (PROGRAM DOWN TO RETRACT/ALARM CODE)
    G31P98Q#145Z#141F.0055 (FINISH DRILL TO DEPTH)
    IF[#5042NE#141]GOTO456 (IF FINAL Z WAS NOT REACHED)
    (THEN SKIP DOWN TO RETRACT MOVE AND ALARM)


    N456
    G0Z-.2
    M283 (HP COOLANT THRU OFF)
    M5
    M505
    #3000=1(T22 DRILL OVERLOADED. CHECK TOOL CONDITION)
    Last edited by reddman; 02-23-2021 at 02:22 PM.

  6. #5
    Join Date
    Feb 2021
    Country
    UNITED STATES
    State/Province
    Utah
    Posts
    9
    Post Thanks / Like
    Likes (Given)
    18
    Likes (Received)
    2

    Default

    Just in case anyone beyond myself cares about this, here is the final version of this process that is proven to function well. There was a logic flaw in the code posted earlier. The #106 macro is there to ensure that any minor rounding discrepancies between the axis position and the target value don't screw up the logic function. This has been changed to dwell rather than retract for the chip break, but it would be easy to change it to do either.

    G99
    (PECK DRILL HOLE)
    #100=-.1(DRILL Z START POS)
    #101=[#561+.23](DRILL FINAL Z DEPTH)
    #102=.006(DRILL PECK INCREMENT)
    #103=.05(DRILL PECK DWELL)
    #104=.008(DRILL FEED RATE)
    #105=90(TORQUE LIMIT. NO DECIMAL)(0-255 RANGE)
    #106=.0001(TOLERANCE FOR IMPRECISION)
    G0Z#100
    WHILE[#100LT[#101-#102]]DO1
    #100=#100+#102(SET PECK Z TARGET)
    G31P98Q#105Z#100F#104(FEED TO Z TARGET)
    IF[[#5042LT[#100+#106]]AND[#5042GT[#100-#106]]]GOTO321
    #100=#101
    N321
    G4U#103
    END1
    IF[#100EQ#101]GOTO456(SKIP TO ALARM)
    G31P98Q#105Z#101F#104(FINISH DRILL TO DEPTH)
    IF[[#5042LT[#101+#106]]AND[#5042GT[#101-#106]]]GOTO331
    (VERIFY DEPTH WAS REACHED)
    GOTO456
    N331
    G0Z-.1

    ...............
    M505
    M30

    N456
    G0Z-.1T0
    M5
    M505 (WAIT FOR SUB TO FINISH BEFORE ALARM)
    #3000=1(T22 OVERLOADED. CHECK BOTH CENTER AND PERIPHERAL INSERTS)


Tags for this Thread

Bookmarks

Posting Permissions

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