Spindle fan time on adjustment

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

Moderator: cnckeith

ashesman
Posts: 395
Joined: Thu Dec 03, 2020 4:54 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Spindle fan time on adjustment

Post by ashesman »

The part of my PLC code that does the spindle fan control is shown below.

It turns the fan on only if the spindle has been running for longer than 10 seconds. That way it doesn't come on for tool changes during setup. In practice it could be longer I think.

After that ten seconds, it turns the fan on while the spindle is running. Then leaves it on for twice as long as the spindle was running, but only up to 5 minutes max. If the spindle overheat input is on, then the fan stays on until five minutes after the switch is off.

And not really much code to do all that! The code could be improved by putting in some constants at the start
if you really were that way inclined. Hope that helps...

Code: Select all


; Definitions
SpindleEnableOut_O              IS OUT7  ;SPST Type INV_EN
SpindleMotorOverheatOk_I        IS INP16 ; S_OH Normally closed (1) when OK 
SpindleCoolingTimeMs_W			 IS W64
SpindleFan_O                    IS OUT28 ;SPST Type (Out 12) SPDL_FAN


; Spindle fan - Run the fan after spindle has been running for 10 seconds and for twice as long as it was running for after it stops
IF SpindleEnableOut_O THEN
	SpindleCoolingTimeMs_W = SpindleCoolingTimeMs_W + 2 * 20
IF !SpindleEnableOut_O THEN
	SpindleCoolingTimeMs_W = SpindleCoolingTimeMs_W - 20		; NOTE:  20ms per iteration

; Limit cooling time to five minutes.  Also force time immediately to five minutes if overheat detected	so always get at least five mins cooling after an overheat
; NOTE:  SpindleMotorOverheatOk_I is normally closed (1) when OK, 0 when overheated
IF !SpindleMotorOverheatOk_I || (SpindleCoolingTimeMs_W > 5 * 60 * 1000) THEN SpindleCoolingTimeMs_W = 5 * 60 * 1000 
IF SpindleCoolingTimeMs_W < 0 THEN SpindleCoolingTimeMs_W = 0

; Note that increase rate is 2 x iteration interval so will count up to 20000ms in 10000ms time but will count down in real time
IF (SpindleFan_O && (SpindleCoolingTimeMs_W > 0)) || (SpindleCoolingTimeMs_W > 20000) THEN (SpindleFan_O)
Post Reply