View Full Version : Program-ABLE Coolant


MR_NC
07-29-2005, 01:12 PM
FWIW,
Thought someone might be able to make use of this. Wrote this macro after finding out that the P-Cool is lame and required operator setting everytime. Seriously friggen weak if you ask me. IMHO, this is the way Haas should have provided it. It sure is nice to stick the friggen tool in and never think about the coolant nozzle.

Things to note:
1. Machine must have to have the P-Cool option (duh)
2. Machine must have to have the Macro option (duh)
3. ALIASING will be used. (see manual under same)
4. You will possibly need to adjust the values for the coolant positions. We can only make use of 17 locations given our shortest tool and longest tool.
5. Editing of the code may be required. (see below)
6. After putting this in use, you will no longer make any p-cool adjustments, the program will do it for you. You will need to add the aliasing M code to the program to auto adjust the p-cool. I used M88 as we don't have TSC, some folks will have to use a different M code to alias if they have TSC.
7. The [AND] statements are sorta strange. They work, however I have had "and" statements fail to produce the desired result in other usage. This is a "bitwise" deal with Haas, not logical. So the use of "and, or, and xor" must be coded with caution (see manual). This has been in service on our machine since shortly after delivery and I can say it has worked great. This is one case where the "and" statement produces the desired result.
8. Machine does not "hold" for adjustment if you alias the M code. Right after I shoot the M88 I have the Z coming down to the part. The Z will be in motion and the coolant will be adjusting. We have a VF3-SS, and no the machine can't make the part before the coolant is in position, even @ 1400IPM :)
9. YOU MUST HAVE A VALID POSITIVE TOOL OFFSET FOR THIS TO WORK TURNKEY! If you use some other offset method you will need to adjust the values to work for your "range" off TLO's.
10. If you have questions just post or PM me. I will try to help you get it working.

I know what your thinking, what about tools longer than 14. Well on our machine, those crashed coming out of the drum, so the P-cool ain't an issue for tools longer than 14 :) Possibly more settings could be added if the machine in question can make use of a P-cool position greater than 17 ours can't. In order for that you would do the following:

Say 19 coolant positions get used in your shop.
1. Your shortest tool is say 1.87
2. Your longest tool is say 18.00
3. You use 19 of the 20 positions to cover this.
4. 18.00 - 1.87 = 16.13(range)
5. 16.13 / 19 = .848 "increment" for checking. (my program = .705)

Best regards,
Sean

CODE*****************

%
O09005 (M88-COOLANT POSITIONING)
(5-24-05)
(USE WITH ALIAS FOR M88 CODE)
(#523 STORES P-COOL POSITION)
(#120 IS FOR VOLITILE USE)
G103 P1
#1= #[ 2000 + #3026 ] (GET TLO VALUE FOR TOOL IN SPDL)
IF [ [ #1 GE 2.000 ] AND [ #1 LT 2.705 ] ] THEN #523= 1
IF [ [ #1 GE 2.705 ] AND [ #1 LT 3.410 ] ] THEN #523= 2
IF [ [ #1 GE 3.410 ] AND [ #1 LT 4.115 ] ] THEN #523= 3
IF [ [ #1 GE 4.115 ] AND [ #1 LT 4.820 ] ] THEN #523= 4
IF [ [ #1 GE 4.820 ] AND [ #1 LT 5.525 ] ] THEN #523= 5
IF [ [ #1 GE 5.525 ] AND [ #1 LT 6.230 ] ] THEN #523= 6
IF [ [ #1 GE 6.230 ] AND [ #1 LT 6.935 ] ] THEN #523= 7
IF [ [ #1 GE 6.935 ] AND [ #1 LT 7.640 ] ] THEN #523= 8
IF [ [ #1 GE 7.640 ] AND [ #1 LT 8.345 ] ] THEN #523= 9
IF [ [ #1 GE 8.345 ] AND [ #1 LT 9.050 ] ] THEN #523= 10
IF [ [ #1 GE 9.050 ] AND [ #1 LT 9.755 ] ] THEN #523= 11
IF [ [ #1 GE 9.755 ] AND [ #1 LT 10.460 ] ] THEN #523= 12
IF [ [ #1 GE 10.460 ] AND [ #1 LT 11.165 ] ] THEN #523= 13
IF [ [ #1 GE 11.165 ] AND [ #1 LT 11.870 ] ] THEN #523= 14
IF [ [ #1 GE 11.870 ] AND [ #1 LT 12.575 ] ] THEN #523= 15
IF [ [ #1 GE 12.575 ] AND [ #1 LT 13.280 ] ] THEN #523= 16
IF [ [ #1 GE 13.280 ] AND [ #1 LT 14.000 ] ] THEN #523= 17
()
()
N10 (HOME P-COOL)
#120= 20.
WH [ #120 GT 0. ] DO1
M35 (MOVE P-COOL UP 1)
#120= #120 - 1.
END1
()
()
N20 (POSITION P-COOL)
#120= 1.
WH [ #120 LT #523 ] DO2
M34 (MOVE P-COOL DOWN)
#120= #120 + 1.
END2
N100
G103
M99
%

Sample code showing usage:*************

G00 X-4.115 Y4.9361 A-90. B180. S4584 M03
M88
M8
G43 H2 Z2.3839

gar
07-29-2005, 05:45 PM
050729-1643 EST USA

MR_NC:

Consider the following to replace your sequence of IFs. I have used different variables because it makes testing and observing the program results easy. One might want to add high and low test limits.

#100 = #[ 2000 + #3026 ]
#101 = [ #100 - 2.0 ] * 1.4184 ( 1/0.705 = 1.4184 )
#102 = FIX [ #101 ] + 1.0
#523 = #102

Obviously this can be simplified for an actual program as follows:

#523 = FIX [ [ #[ 2000 + #3026 ] - 2.0 ] * 1.4184 + 1.0 ] ( note multiplication and divison take precedence over addition and subtraction.

When AND is used in an IF statement it is treated as a logical operator, and when AND is used with variables it is a bitwise AND function which is very useful for masking operations,

.

MR_NC
08-01-2005, 10:13 AM
050729-1643 EST USA

MR_NC:

Consider the following to replace your sequence of IFs. I have used different variables because it makes testing and observing the program results easy. One might want to add high and low test limits.

#100 = #[ 2000 + #3026 ]
#101 = [ #100 - 2.0 ] * 1.4184 ( 1/0.705 = 1.4184 )
#102 = FIX [ #101 ] + 1.0
#523 = #102

Obviously this can be simplified for an actual program as follows:

#523 = FIX [ [ #[ 2000 + #3026 ] - 2.0 ] * 1.4184 + 1.0 ] ( note multiplication and divison take precedence over addition and subtraction.

When AND is used in an IF statement it is treated as a logical operator, and when AND is used with variables it is a bitwise AND function which is very useful for masking operations,

.


Thanks Gar,
I am more an "old school" guy myself. Programs and such that I only write once I tend to leave pretty vebrose. Sometimes after putting something away for a long time I find it easier to follow what I have done if I don't lean things out too much. The other reason I did it this way was to provide a clean option for "tweaking" only some of the ranges if required. This way I can edit each range or such if I need more overlap in an area or somesuch. Given the tools we use.

Clearly your code is much more compact. Of course this is preferred by most folks.

Indeed this makes sense about the "AND" statement. It works here, however when used against variables it does not (at least logical). This explains what the story is.

Best regards,
Sean

gar
08-01-2005, 01:31 PM
050801-1229 EST USA

MR_NC:

Initially I did not look at all your increments. I just looked at the first two and then I wrote the short code for the ifs. Later I found you had used equal increments. If not I was thinking it might be necessary to add some trig function.

When I see a sequential test, such as your ifs, it is a challenge to look for a simpler procedure.

With equal increments do you get adequate positioning accuracy?

Internally in most computers at the machine language level the AND function is the bit wise AND of two registers. This is neat for making a modulo 1024 counter by ANDing the counting register with the constant 1023. No comparisons needed. In the case of UARTs you can test two or more bits at once to determine if the UART needs service.

.

MR_NC
08-02-2005, 11:27 AM
050801-1229 EST USA

MR_NC:

Initially I did not look at all your increments. I just looked at the first two and then I wrote the short code for the ifs. Later I found you had used equal increments. If not I was thinking it might be necessary to add some trig function.

When I see a sequential test, such as your ifs, it is a challenge to look for a simpler procedure.

With equal increments do you get adequate positioning accuracy?

A. Yea it seems to work pretty good. I have not messed with it since implemenation. Since Haas is only providing "increment feedback" and not "position feedback" I am thinking it is about as good as it gets. The idea was with all the "if checks" I could tune if required.

Internally in most computers at the machine language level the AND function is the bit wise AND of two registers. This is neat for making a modulo 1024 counter by ANDing the counting register with the constant 1023. No comparisons needed. In the case of UARTs you can test two or more bits at once to determine if the UART needs service.

I will pretend I understood that ;)
.

Best regards,
Sean

gar
08-02-2005, 09:49 PM
050802-2049 EST USA

MR_NC:

Arithmetic modulo X is a subject of number theory. This is sometimes referred to as "clock arithmetic". It is a form of integer arithmetic with a finite number of integers.

A MOD 4 sytem only contains the integers 0, 1, 2, 3. A MOD 1024 number system only includes the integers 0, 1, 2, .... thru 1023, base 10. This means there are only 1024 integers in this number system. If I add 1 to 1023 that equals 1024 in an infinite number system. 1 + 1023 mod 1024 = 0, and 2 +1023 = 1, etc.

Why this funny number 1024. This is because 2 to the 10th power = 1024, and 1024 converted to binary is 10000000000, and 1023 is 01111111111 .
If I counted correctly there are 10 zeros, and 10 ones.

If I make register DX a counter, then by bitwise ANDing 011 1111 1111 ( base 16 this is 3FF ) with DX I turn DX into a counter MOD 1024.

For those unfamiliar with how a counter is generated in a computer the following illustrates the function:

ADD DX, 1 ................ this adds 1 to the current content of register DX and puts the new value in DX.

To make it MOD1024

ADD DX, 1
AND DX, 01111111111b


You can increment this counter by any desired amount. If I am working in binary or integer the increment would not contain a fraction. However, for other purposes I might count by some number like 3.1416.

If I want to make a counter MOD 1000 then it is not so easy. Here I have to do a compaison and this takes longer than AND in a typical computer.

.