12.10.2    Rotate Fans on Start-Stop - Tcl

 

catch {

if {[GETVAL FAN_START101] >= 0.5} then {

SETVAL {rotatefan101=%ROTATEPLUS 12} #fan 101 uses rotateplus

}}

 

# fan 102 uses loopplus to be different

catch {

if {[GETVAL FAN_START102] >= 0.5} then {

SETVAL {rotatefan102=%LOOPPLUS 12}

}}

 

catch {

if {[GETVAL FAN_START103] >= 0.5} then {

SETVAL {rotatefan103=%LOOPMINUS 12} # loopminus reverses direction

}}

 

Change speed of Rotation

 

# dx is a TCL variable that must be evaluated by TCL.

# Expression inside double quotes is evaluated.

# radius, speed, position and rotatewheel are IO tags.

# The value of these IO tags are passed to TCL and do not need to

# be evaluated. 

# The IO tags are treated like constant string by TCL.

# Curly bracket treated a constant string.

set dx [expr [GETVAL radius]*[GETVAL speed]/180.0*3.1415926]

SETVAL "position=%LOOPPLUS $dx"

SETVAL {rotatewheel=%ROTATEPLUS @speed}