586,058 active members*
3,320 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Fanuc > Fanuc 18: macro program execution speed
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2011
    Posts
    0

    Fanuc 18: macro program execution speed

    Hello,

    I want to know how to accelerate execution speed of G-code macro program.

    My g-code program calculates trigonometric functions sin, cos and so on.
    I thought the bottleneck is there. But after reduced quite some of the instructions, the execution speed is not improved as I expected.

    the calculation itself is not bottle neck? or g-code instructions are equally slow?

    Is there a way to improve the performance?

    Thanks in advance.

    Ting

  2. #2
    Join Date
    Sep 2005
    Posts
    767
    Are your macro calculation statements mixed with any axis motion commands or external commands (like M, S, or T-codes) ? The purely macro commands should execute very fast, but if there is an axis motion command, the next macro statement must wait until the motion is complete. Same situation with M, S, and T-codes. The next macro statement must wait for the "FIN" signal.

    Are you using any of the axis position system variables in your macros?

    Please post an example of your macro where speed is an issue.

  3. #3
    Join Date
    Aug 2011
    Posts
    0
    Thank you very much for your hint.

    The following is a part (subroutine) of the program.
    It is basically all about calculations - as you can see, the 3D position calculation. Only after the final position is calculated are the motion related commands used.

    I tried to optimize part of the program - for example, the comment parts of the following code are the original version, and they are rewritten.

    But this kind of optimization has little improvement.

    I doubt the g-code language execution itself is slow: read, parse, syntax check, execute ...

    I even doubt, the display - seicos sigma 10 - takes much time. Because it lists the g-code source line by line during execution, even though the text scrolling speed is high enough, it does display the codes line by line.


    O9606(3D ROTATION SUB)

    #900 = #2*#2+#3*#3

    #27=SQRT[#900]
    #28=SQRT[#1*#1 + #900]
    #4=#24-#21
    #5=#25-#22
    #6=#26-#23

    IF[[#2EQ0]AND[#3EQ0]]THEN
    #7=-#6
    #8=#5
    #9=#4
    IF [#1LT0] THEN
    #7=-#7
    #9=-#9
    ENDIF

    ELSE

    #900 = #1/#27
    #901 = [#5*#2 + #6*#3]

    (#7=#4*#27/#28-#5*#1*#2/#27/#28-#6*#1*#3/#27/#28)
    (#8=#5*#3/#27-#6*#2/#27 )
    (#9=#4*#1/#28+#5*#2/#28+#6*#3/#28 )
    #7 =[ #4*#27 - #901*#900 ]/#28
    #8 =[ #5*#3 - #6*#2]/#27
    #9 =[ #4*#1 + #901 ]/#28

    ENDIF

    #900 = COS[#20] (20110726xing)
    #901 = SIN[#20]
    (#10=#7*COS[#20]-#8*SIN[#20])
    (#11=#7*SIN[#20]+#8*COS[#20])
    #10=#7*#900 - #8*#901
    #11=#7*#901 + #8*#900

    #12=#9

    IF[[#2EQ0]AND[#3EQ0]]THEN

    (#13=#12*#1/ABS[#1])
    (#14=#11)
    (#15=-#10*#1/ABS[#1])

    #13=#12
    #14=#11
    #15=-#10
    IF [#1LT0] THEN
    #13=-#13
    #15=-#15
    ENDIF

    ELSE

    #900 = #2/#28
    #901 = #3/#28
    #902 = -#10*#1
    (#13=#10*#27/#28+#12*#1/#28)
    (#14=-#10*#1*#2/#27/#28+#11*#3/#27+#12*#2/#28)
    (#15=-#10*#1*#3/#27/#28-#11*#2/#27+#12*#3/#28)
    #13= [#10*#27+#12*#1]/#28
    #14= [#902*#900 + #11*#3]/#27 + #12*#900
    #15= [#902*#3/#28-#11*#2]/#27 + #12*#901

    ENDIF

    #117=#13+#21
    #118=#14+#22
    #119=#15+#23

    IF[ABS[#117]LT0.001]THEN#117=0
    IF[ABS[#118]LT0.001]THEN#118=0
    IF[ABS[#119]LT0.001]THEN#119=0
    M99

  4. #4
    Join Date
    Sep 2005
    Posts
    767
    This kind of macro should run pretty fast. Have you tried turning off the display of macro program data? It may run faster that way.

    I suggest you perform some benchmark tests. Are you calling this macro for EVERY motion command? If so, it may be executing pretty fast, but if you call it for every move, it will still slow you down quite a bit.

    Why not write a program to 3D rotate the program on a PC and let the CNC just run the rotated data?

  5. #5
    Join Date
    Aug 2011
    Posts
    0
    Dear sir,

    Thank you very much for your advice.

    How to turn off display of macro program ?

    According to my measurement, the macro execution time is about 3 to 4 seconds for every motion. And because more than 4000 points are to be drilled, the time is rather remarkable!

    Sure, pre-calculation is a good option. I am now considering it. Because there are 4000 points, direct-move macro will be rather long - including drill life test instructions. It will surely be out of the capacity of my machine's memory.
    I learned that a way of "drip feeding" will work - feed the large program to my CNC through RS232(?), but am not sure whether my CNC supports it.
    (SEICOS sigma 18)

    Ting

  6. #6
    Join Date
    Feb 2006
    Posts
    338
    I would suggest trying some time tests.

    A program that just cycles 100 times thru this macro. You time it using the CNC clock (#3012 I think) store at the start, and compare at the end.

    That should give you a good baseline for this code execution.

    Try G65 vs M98 It will require a different approach for variable handling, but may change the time between main/sub execution.

    The control has a small but minimum time it takes to process each line of code (comment or otherwise)

    If your using any goto jumps in the code they also take time for the machine to search thru the code. I made noticeable time improvements in some engraving subs by putting the most used characters near the start of the sub. (searching for 1 of 36 characters then exiting)

    For other ideas, can you provide a few lines of the main program around the call for this?

  7. #7
    Join Date
    Feb 2006
    Posts
    1792
    Which control is this?
    Seems to be more advanced than Fanuc.

  8. #8
    Join Date
    Aug 2011
    Posts
    0
    Thank you all very much.

    I think as what advised I should do some time test.

    And also the best solution might be pre-calculation. I am trying to calculate all the X, Y, Z, A, and B data before the real machining.
    Because the data point number mounts up to 4000, the CNC code program will be very large (including life test etc.). I am considering using RS232 to feed the instructions.

    However optimized, the code execution consumes considerable time. So I think the pre-calculation might be the final (fastest) method (?).

    Ting

  9. #9
    Join Date
    Feb 2006
    Posts
    338
    If you do go thru and do the time tests, It would be nice to see the results.

Similar Threads

  1. Replies: 5
    Last Post: 12-16-2012, 08:43 AM
  2. Fanuc OM Program Execution
    By Camber in forum Fanuc
    Replies: 12
    Last Post: 04-20-2011, 11:44 AM
  3. Fanuc 0M-C Macro Program
    By KARD in forum Fanuc
    Replies: 2
    Last Post: 11-10-2009, 02:26 PM
  4. Replies: 2
    Last Post: 03-27-2009, 09:15 PM
  5. Convert Fanuc Macro to Fadal Macro
    By bfoster59 in forum Fadal
    Replies: 1
    Last Post: 11-09-2007, 06:41 AM

Posting Permissions

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