CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > Fanuc


Fanuc Discuss Fanuc controllers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 08-08-2011, 05:00 AM
 
Join Date: Aug 2011
Location: Japan
Posts: 4
xingchengting is on a distinguished road
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
Reply With Quote

  #2   Ban this user!
Old 08-08-2011, 05:52 AM
 
Join Date: Sep 2005
Location: USA
Age: 60
Posts: 755
Dan Fritz is on a distinguished road

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.
Reply With Quote

  #3   Ban this user!
Old 08-08-2011, 09:45 PM
 
Join Date: Aug 2011
Location: Japan
Posts: 4
xingchengting is on a distinguished road

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
Reply With Quote

  #4   Ban this user!
Old 08-09-2011, 07:15 PM
 
Join Date: Sep 2005
Location: USA
Age: 60
Posts: 755
Dan Fritz is on a distinguished road

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?
Reply With Quote

  #5   Ban this user!
Old 08-11-2011, 04:40 AM
 
Join Date: Aug 2011
Location: Japan
Posts: 4
xingchengting is on a distinguished road

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
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 08-11-2011, 10:57 PM
 
Join Date: Feb 2006
Location: United States
Posts: 273
dpuch is on a distinguished road

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?
Reply With Quote

  #7   Ban this user!
Old 08-17-2011, 03:31 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Which control is this?
Seems to be more advanced than Fanuc.
Reply With Quote

  #8   Ban this user!
Old 08-21-2011, 07:49 PM
 
Join Date: Aug 2011
Location: Japan
Posts: 4
xingchengting is on a distinguished road

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
Reply With Quote

  #9   Ban this user!
Old 08-26-2011, 07:01 PM
 
Join Date: Feb 2006
Location: United States
Posts: 273
dpuch is on a distinguished road

If you do go thru and do the time tests, It would be nice to see the results.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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




All times are GMT -5. The time now is 07:17 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361