PLC Program Help splitting Mist and Clamp functions (Answered)

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
tblough
Community Expert
Posts: 3540
Joined: Tue Mar 22, 2016 10:03 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Boston, MA
Contact:

PLC Program Help splitting Mist and Clamp functions (Answered)

Post by tblough »

Working on modifying my PLC program (v6 for CNC12 AllIn1DC) for the new mill and I'm trying to split the mist coolant and rotary table clamp functions. I have mist on OUT4 and clamp on OUT9.

Code: Select all

.
.
.

RotaryTableHome               IS INP8  ;RTB 12/28 - DoorClosed  IS INP8
RotaryTableClamped            IS INP13 ;RTB 12/28 - SpinLowRange  IS INP13
;spare RTB 12/28 SpinMedRange                  IS INP14
;spare RTB 12/28 SpinHighRange                 IS INP15
;spare                        IS INP16

.
.
.

Mist                          IS OUT4  ;RTB 12/26 - MistOrClamp  IS OUT4  ;SPST Type Can be configured for Mist or Clamp
InverterResetOut              IS OUT5  ;SPST Type
WorkLightOut                  IS OUT6  ;SPST Type
SpindleEnableOut              IS OUT7  ;SPST Type
SpindleDirectionOut           IS OUT8  ;SPDT Type
RotaryTableClamp              IS OUT9  ;RTB 12/26 - ZBrakeRelease                 IS OUT9  ;SPDT Type 

.
.
.

;RTB 12/26 split mist coolant (out4) from clamp (out9)
;;--Mist coolant on/off
;IF !ClampEnabled_M && (CoolMistKey || KbMistOnOff_M) THEN (CoolantMistPD)
;IF (ClampEnabled_M && M10) || (!ClampEnabled_M && (((Mist ^ (!CoolAutoModeLED && CoolantMistPD))
;   || CoolAutoModeLED && M7)
;   && !(SV_STOP ||
;        CoolAutoModeLED && !M7 ||
;        ErrorFlag_M ||
;        DoToolCheck)))
;  THEN (Mist), (CoolMistLED), (SelectCoolantMist)
;  
;IF ClampEnabled_M THEN RST CoolMistLED, RST SelectCoolantMist


;--Mist coolant on/off
IF CoolMistKey || KbMistOnOff_M THEN (CoolantMistPD)
IF ((Mist ^ (!CoolAutoModeLED && CoolantMistPD))
   || CoolAutoModeLED && M7)
   && !(SV_STOP ||
        CoolAutoModeLED && !M7 ||
        ErrorFlag_M ||
        DoToolCheck)
  THEN (Mist), (CoolMistLED), (SelectCoolantMist)

; Rotary Table Clamp on/off
IF (ClampEnabled_M && M10) THEN (Clamp)

.
.
.
I'm not sure how to handle the rotary table clamped feedback signal which is on INP8 or how to handle the M11 unclamp command.
Last edited by tblough on Wed Jan 16, 2019 10:57 am, edited 1 time in total.
Cheers,

Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.


cncsnw
Community Expert
Posts: 4589
Joined: Wed Mar 24, 2010 5:48 pm

Re: PLC Program Help splitting Mist and Clamp functions

Post by cncsnw »

Generally, M11 is the absence of M10.

Supposing you are using request bit 4 (SV_M94_M95_4) for the rotary clamp, your M10 macro would include "M94/4" to turn it on; your M11 macro would include "M95/4" to turn it off; and your PLC program would give the name "M10" to SV_M94_M95_4.

If you want to wait for the clamp acknowledge to appear when the clamp is applied (and perhaps wait for it to go away when the clamp is released) you would do that with M101 and M100 codes in the M10 and M11 macros. The PLC program would not be involved.

For example, assuming the clamp acknowledge is on INP13, your M10 macro might say:

Code: Select all

M94/4
M101/50013
and your M11 macro might say:

Code: Select all

M95/4
M100/50013
Likewise, the rotary table home switch is not involved in any PLC logic. You just enter the input number in the "Home" switch input columns on the Machine Configuration -> Motor Parameters table, for the appropriate axis.


tblough
Community Expert
Posts: 3540
Joined: Tue Mar 22, 2016 10:03 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Boston, MA
Contact:

Re: PLC Program Help splitting Mist and Clamp functions

Post by tblough »

Marc,

The new V6 PLC program is set up to use OUT3 as either mist coolant or clamp. I need both so I modified Centroid's PLC code to take the ClampEnabled_M variables out of the mist coolant section. Originally the code checked for (ClampEnabled_M && M10) || Mist and if true then set (MistOrClamp) which was OUT3. Now it is essentially IF Mist THEN (Mist).

I need to figure out how to write what will be essentially IF (ClampEnabled_M && M10) THEN (RotaryTableClamp) with all the other checks for program stop and errors, then monitors RotaryTableIsClamped and makes sure it stays ON while the M10 is active and issues an error if it goes off when M10 is active. I'm also not sure if all of the above should be in the new Fourth Axis Stage and exactly how parameter 800 fits in.

I'm just not sure how to write all that in PLC speak.
Cheers,

Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.


cncsnw
Community Expert
Posts: 4589
Joined: Wed Mar 24, 2010 5:48 pm

Re: PLC Program Help splitting Mist and Clamp functions

Post by cncsnw »

It is my personal opinion that multiplexing outputs ("MistOrClamp") is a bad idea; and also that defining a limited set of configurations, then compelling users to choose one of them (i.e. the parameter 800 "feature") is also a bad idea.

I think the intent was to save some number of users the trouble of learning how to modify the PLC program or macros.

In my opinion, the effect was to make an excessively complex structure, that still needs to be modified (e.g. if you happen to want to have both mist coolant and a rotary clamp), but which is much more difficult to modify than a simpler and cleaner program.

My advice is to delete everything related to parameter 800, and to configuration checking and validation, and just put in the features you need (and delete the features you don't need).

Do you want the rotary clamp to be automatically released when the program cycle ends (whether it ends normally, or due to an error or fault)? If so, then include "IF !SV_PROGRAM_RUNNING THEN RST M10" logic somewhere (either combined with the same block that resets M3, M4, M7 and M8 when the program ends; or in a separate block).

Alternately, if you want the rotary clamp to remain applied until you program an M11, then simply delete the above logic, if it happens to be present.

As to your clamp confirmation and custom error request: you will almost certainly need a timer to hold off the error check for a fraction of a second, since it will take at least one scan (20ms) after the M10 request turns on, before the clamp output is turned on; and it will likely take quite a bit longer before the pressure switch actually closes. For example:

Code: Select all

ROTARY_CLAMP_ERR IS 2 + 256 * ___
;...
RotaryTableClamped IS INP13
;...
Clamp IS OUT9
;...
Clamp_T IS T__
;...
IF M10 THEN (Clamp),
       Clamp_T = 500,
       SET Clamp_T
IF !M10 THEN RST Clamp_T
IF Clamp_T && !RotaryTableClamped
  THEN ErrorMsg_W = ROTARY_CLAMP_ERR,
       SET ErrorFlag_M,
       RST M10
For more about defining custom error messages, see http://www.cncsnw.com/PLCApplicationsMPU11.htm


Post Reply