![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Fanuc Discuss Fanuc controllers here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
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
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| 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 |
| Sponsored Links |
|
#6
| |||
| |||
| 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? |
|
#8
| |||
| |||
| 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 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Fanuc OM Program Execution | Camber | Fanuc | 12 | 04-20-2011 05:44 AM |
| Fanuc 0M-C Macro Program | KARD | Fanuc | 2 | 11-10-2009 07:26 AM |
| Testing program for Macro (Fanuc Macro B) | NickDP | Fanuc | 2 | 03-27-2009 03:15 PM |
| Wintec MV-45 with FANUC 18MC needs ATC Macro program | hrh | Fanuc | 4 | 01-12-2009 01:33 PM |
| Convert Fanuc Macro to Fadal Macro | bfoster59 | Fadal | 1 | 11-08-2007 11:41 PM |