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 > G-Code Programing > Parametric Programing


Parametric Programing (custom macro b, fadal macro, okuma user task)


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 10-26-2011, 03:43 PM
 
Join Date: Jan 2009
Location: USA
Posts: 39
ggborgen is on a distinguished road
Double End in a While Loop

Gentlemen,
Will this example work:
WHILE[#103LE#100DO1
#102=#102-#101
#108=ABS[#102]
#104=[#18*#18]
#105=[#108*#108]
#106=#104-#105
#107=SQRT[#106]
#109=#108/#107
#110=ATAN[#110]
IF[#110GT45.]GOTO20
G1
G3
G3
G3
#103=#103+1.
END1
N20
G1
G3
G3
G3
#103=#103+1.
END1

I would use GOTO Statements but the cutter pauses after every pass.
Thanks
Reply With Quote

  #2   Ban this user!
Old 10-26-2011, 10:20 PM
 
Join Date: Sep 2010
Location: Australia
Posts: 733
angelw is on a distinguished road

Originally Posted by ggborgen View Post
Gentlemen,
Will this example work:
WHILE[#103LE#100DO1
#102=#102-#101
#108=ABS[#102]
#104=[#18*#18]
#105=[#108*#108]
#106=#104-#105
#107=SQRT[#106]
#109=#108/#107
#110=ATAN[#110]
IF[#110GT45.]GOTO20
G1
G3
G3
G3
#103=#103+1.
END1
N20
G1
G3
G3
G3
#103=#103+1.
END1

I would use GOTO Statements but the cutter pauses after every pass.
Thanks
No. DO n and End n must correspond to each in one program.

Something like the following may help you
#1=0 (Control Flag - initialize before starting DO Loop)
WHILE[#103LE#100]DO1
#102=#102-#101
#108=ABS[#102]
#104=[#18*#18]
#105=[#108*#108]
#106=#104-#105
#107=SQRT[#106]
#109=#108/#107
#110=ATAN[#110]
WHILE [[#110 LE 45.] AND [#1=0]] DO2
#1=1 (Set Control Flag so DO2 executes only once)
G1
G3
G3
G3
#103=#103+1.
END2
#1=0 (Reset Control Flag so that DO2 will execute again if #110 LE 45.)
N20
G1
G3
G3
G3
#103=#103+1.
END1


Regards,

Bill

Last edited by angelw; 10-27-2011 at 06:44 AM.
Reply With Quote

  #3   Ban this user!
Old 10-28-2011, 03:27 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Read the attachment for correct syntax of ATAN function.
Attached Files
File Type: pdf ATAN syntax.pdf‎ (48.4 KB, 35 views)
Reply With Quote

  #4   Ban this user!
Old 11-01-2011, 03:57 PM
 
Join Date: Jan 2009
Location: USA
Posts: 39
ggborgen is on a distinguished road
ATAN syntax

Sinha nsit,
Are you telling me there is something wrong with my syntax? Thanks
Reply With Quote

  #5   Ban this user!
Old 11-02-2011, 05:45 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

This is not correct:
#110=ATAN[#110]
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 11-02-2011, 06:54 AM
 
Join Date: Sep 2010
Location: Australia
Posts: 733
angelw is on a distinguished road

Originally Posted by ggborgen View Post
Sinha nsit,
Are you telling me there is something wrong with my syntax? Thanks
I think what Sinha is saying is that the result when using the ATAN function correctly is an angle. The function provides the Arctangent of the Opposite side to an angle of a triangle divided by its adjacent side to the same angle. The syntax being as follows:

Arctangent
#i=ATAN[#j]/[#k];
Where:
#1 = the resulting angle
#j = the opposite side
#k = the adjacent side

Now, I've never tried to use the ATAN function in any other way other way than in the above syntax example. Its my understanding that the function requires two arguments, and not just the TAN of an angle. I'll check that out.

In your example program, its not shown where #110 is allocated a value; obviously somewhere prior to the WHILE statement.

Lets say #110 was allocated the TAN of an angle elsewhere, and that #110 = ATAN[#110] did not result in a syntax error. In your example program, the first time through the loop, #110 would take on the value of the angle extrapolated from getting the Arctangent of the TAN of an angle ; the second time through, the angle #110 would be plugged back in as the TAN of an angle. For example:

#110 = TAN [45] (#110 = 1)
ATAN[#110] (#110 = 45)
ATAN[#110] (#110 = 88.7269)

Regards,

Bill
Reply With Quote

  #7   Ban this user!
Old 11-02-2011, 07:30 AM
 
Join Date: Jan 2009
Location: USA
Posts: 39
ggborgen is on a distinguished road
Correction #110=ATAN[#109]

Gentlemen,
My example should be as follows:
#110=ATAN[#109]
Sorry about the mistake, so would this work? Thanks
Reply With Quote

  #8   Ban this user!
Old 11-02-2011, 07:44 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

No.
Read the syntax given in Angelw's previous post or my attachment in post #3.
Reply With Quote

  #9   Ban this user!
Old 11-02-2011, 08:06 AM
 
Join Date: Jan 2009
Location: USA
Posts: 39
ggborgen is on a distinguished road
Example from Fanuc manual for a 31i control

Gentlemen,
Here's an example from a Fanuc control manual:

#i=ATAN[#j] Arc tangent (one argument)
#i=ATAN[#j]/[#k] Arc tangent (two arguments)
#i=ATAN[#j,#k] Arc tangent (two arguments)

So how does the first example differ from my syntax? Thanks
Reply With Quote

  #10   Ban this user!
Old 11-02-2011, 08:34 AM
 
Join Date: Sep 2010
Location: Australia
Posts: 733
angelw is on a distinguished road

Originally Posted by ggborgen View Post
Gentlemen,
Here's an example from a Fanuc control manual:

#i=ATAN[#j] Arc tangent (one argument)
#i=ATAN[#j]/[#k] Arc tangent (two arguments)
#i=ATAN[#j,#k] Arc tangent (two arguments)

So how does the first example differ from my syntax? Thanks
As I stated in my Post #6, I've not used the ATAN function using only the one argument (TAN of angle), simple because, and purely by chance, I've always been calculating the TAN of the angle in the same operation. I've not seen it expressed in a one argument format, but clearly, it would be a big advantage to be able to just plug in the TAN value if it were already known. If the Fanuc manual indicates that the single argument is valid, then
#109=#108/#107
#110=ATAN[#109]
would be fine if #108 and #107 are the opposite and adjacent sides respectively.

As you're probably aware, the above could also be written as follows:

#110=ATAN[#108] / [#107]

Regards,

Bill

Last edited by angelw; 11-02-2011 at 09:31 AM.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 11-03-2011, 05:22 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Originally Posted by ggborgen View Post
Gentlemen,
Here's an example from a Fanuc control manual:

#i=ATAN[#j] Arc tangent (one argument)
#i=ATAN[#j]/[#k] Arc tangent (two arguments)
#i=ATAN[#j,#k] Arc tangent (two arguments)

So how does the first example differ from my syntax? Thanks
Refer to the original Fanuc manuals. Do not believe on what I say or what others say.
The best way would be to test it on your machine. And please do report back.

There is a good reason why Fanuc defined ARCTAN this way.
tan 45 and tan 225 are both 1. What should be the out put of arctan 1?
Similarly, tan (-45) and tan 135 are both -1. arctan (-1) would be ambiguous.

1/1 and -1/-1 are both equal to 1, but refer to angles in I and III quadrants, respectively.
-1/1 and 1/-1 are both equal to -1, but refer to angles in IV and II quadrants, respectively.

Thus Fanuc's ATAN always gives correct value of angle.
Incidently, this feature is not available in even high-level languages such as Pascal.
Reply With Quote

  #12   Ban this user!
Old 11-03-2011, 08:27 AM
 
Join Date: Jan 2009
Location: USA
Posts: 39
ggborgen is on a distinguished road
Will this work?

Gentlemen,
Will this work?

WHILE[#***LE#***]DO1
***
***
G65P****
***
***
END1
Basically make another macro call in side a While loop. Thanks
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
Open Loop to Closed Loop Stepper Conversion beamhome Stepper Motors and Drives 9 05-24-2012 02:46 AM
New 6-axis Double-Closed-Loop Controller? brccrb Product Announcements & Manufacturer News 28 03-04-2009 09:46 PM
CNC Brain is ready! 6-axis Double Closed Loop Controller brccrb CncBrain 628 02-02-2009 07:47 AM
CNC Brain is ready! 6-axis Double Closed Loop Controller brccrb Product Announcements & Manufacturer News 374 09-17-2008 07:42 PM
question on closed loop vs open loop (servo systems) boonie Servo Motors and Drives 20 11-09-2007 12:30 PM




All times are GMT -5. The time now is 01:05 AM.





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