Implement SC (stop code)
r2523 | dcl | 2008-05-12 11:08:15 +1000 (Mon, 12 May 2008) | 2 lines
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/tclsh
|
||||
|
||||
# $Revision: 1.7 $
|
||||
# $Date: 2007-11-06 03:49:11 $
|
||||
# $Revision: 1.8 $
|
||||
# $Date: 2008-05-12 01:08:15 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by: $Author: ffr $
|
||||
# Last revision by: $Author: dcl $
|
||||
|
||||
# Creates fake DMC configuration files based on the instrument
|
||||
# configuration file.
|
||||
@@ -70,7 +70,7 @@ proc mkSimAxes {instrument} {
|
||||
set enPos 0;
|
||||
set enCnts 0;
|
||||
}
|
||||
puts $simFile($IPtoContName($motor(asyncqueue)-$instrument)) "array set $nm \[\list TD 0 TP $enPos BG 0 ST 0 SP $speed AC $acc DC $dec cntsperx $enCnts stepsperx $motor(stepsperx) PA 0 TS 44 \]";
|
||||
puts $simFile($IPtoContName($motor(asyncqueue)-$instrument)) "array set $nm \[\list SC 1 TD 0 TP $enPos BG 0 ST 0 SP $speed AC $acc DC $dec cntsperx $enCnts stepsperx $motor(stepsperx) PA 0 TS 44 \]";
|
||||
|
||||
# eval "lappend $IPtoContName($motor(host))_motors $m";
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# $Revision: 1.6 $
|
||||
# $Date: 2007-11-07 04:42:31 $
|
||||
# $Revision: 1.7 $
|
||||
# $Date: 2008-05-12 01:08:15 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by: $Author: ffr $
|
||||
# Last revision by: $Author: dcl $
|
||||
|
||||
# Requires a configuration array for each axis that you want to simulate.
|
||||
# eg
|
||||
@@ -65,6 +65,7 @@ proc BG {_axis} {
|
||||
upvar #0 $_axis axis;
|
||||
set axis(TS) 140; # moving, limit switches open
|
||||
set axis(BG) 1; # motor is moving
|
||||
set axis(SC) 0; # motor is running
|
||||
set timeStep 0.1; # seconds
|
||||
set target $axis(PA);
|
||||
set diff [expr $target - $axis(TD)];
|
||||
@@ -85,7 +86,7 @@ proc BG {_axis} {
|
||||
# Don't handle _XQ _HX
|
||||
proc MG {args} {
|
||||
# Skip formatting
|
||||
if {[string index [lindex $args 0] 0] == F} {
|
||||
if {[string index [lindex $args 0] 0] == "F"} {
|
||||
set msg [lrange $args 1 end]
|
||||
}
|
||||
# If msg starts with _ then return val for axis
|
||||
@@ -114,6 +115,7 @@ proc nextstep {paxis step target} {
|
||||
set axis(TS) 44; # Stopped, limit switches open
|
||||
set axis(BG) 0; # motor has stopped
|
||||
set axis(ST) 0; # make sure stop flag is unset
|
||||
set axis(SC) 4; # motor stopped by stop command (ST)
|
||||
return 0;
|
||||
} elseif {[expr abs($target - $axis(TD)) < abs($step)]} {
|
||||
set diff [expr $target - $axis(TD)];
|
||||
@@ -122,6 +124,7 @@ proc nextstep {paxis step target} {
|
||||
set axis(TS) 44; # Stopped, limit switches open
|
||||
set axis(BG) 0; # motor has stopped
|
||||
set axis(ST) 0; # make sure stop flag is unset
|
||||
set axis(SC) 1; # motor stopped at commanded position
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user