diff --git a/site_ansto/instrument/TEST_SICS/fakeDMC/dmc2280Server.tcl b/site_ansto/instrument/TEST_SICS/fakeDMC/dmc2280Server.tcl index db5ba73f..ea4fdc0a 100644 --- a/site_ansto/instrument/TEST_SICS/fakeDMC/dmc2280Server.tcl +++ b/site_ansto/instrument/TEST_SICS/fakeDMC/dmc2280Server.tcl @@ -1,5 +1,5 @@ -# $Revision: 1.2 $ -# $Date: 2007-03-16 06:11:56 $ +# $Revision: 1.3 $ +# $Date: 2007-10-31 06:10:30 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by: $Author: ffr $ @@ -32,10 +32,14 @@ proc readLine {who channel} { eval [parse $line] puts -nonewline $channel ":" } - "TP*" - "TD*" { + "TP*" - "TD*" - "TI*" - "XQ*" { set output [eval [parse $line]] puts $channel " $output"; puts -nonewline $channel ":" } + "LV" { + set output [eval [parse $line]] + puts $channel "$output"; puts -nonewline $channel ":" + } "TS*" { set output [eval [parse $line]] puts $channel " $output"; puts -nonewline $channel ":" diff --git a/site_ansto/instrument/TEST_SICS/fakeDMC/dmcParse.tcl b/site_ansto/instrument/TEST_SICS/fakeDMC/dmcParse.tcl index 897500a0..36a1adea 100644 --- a/site_ansto/instrument/TEST_SICS/fakeDMC/dmcParse.tcl +++ b/site_ansto/instrument/TEST_SICS/fakeDMC/dmcParse.tcl @@ -1,5 +1,5 @@ -# $Revision: 1.1 $ -# $Date: 2006-10-12 23:06:05 $ +# $Revision: 1.2 $ +# $Date: 2007-10-31 06:10:30 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by: $Author: ffr $ @@ -14,7 +14,7 @@ proc parse {cmdst args} { if {[string length $args] > 0} {return "$cmdst $args"} # _CM, {TP,TD} get an axis property or position - set num [scan $cmdst {_%2s%1[ABCDEFGH0-7]} cmd an]; + set num [scan $cmdst {_%2s%1[ABCDEFGH]} cmd an]; if {$num == 2} {return "dmget $cmd $an"} set num [scan $cmdst {%2s%1[ABCDEFGH]} cmd axis]; if {$num == 2 && [string first $cmd "TD TP"] != -1} { @@ -31,9 +31,11 @@ proc parse {cmdst args} { return "dmset $cmd $axis [lindex $cmdlst 1]"; } - # CM - set num [scan $cmdst {%2s%1[ABCDEFGH]} cmd axis]; - if {$num == 2} {return "dmcall $cmd $axis"} + # CM + set num [scan $cmdst {%2s%1[ABCDEFGH0-7]} cmd par]; + if {$num == 2} {return "dmcall $cmd $par"} + set num [scan $cmdst {_%2s%1[ABCDEFGH0-7]} cmd par]; + if {$num == 2} {return "dmcall $cmd $par"} return $cmdst; diff --git a/site_ansto/instrument/TEST_SICS/fakeDMC/mkSimAxes.tcl b/site_ansto/instrument/TEST_SICS/fakeDMC/mkSimAxes.tcl index f2a3ab85..4f1da048 100755 --- a/site_ansto/instrument/TEST_SICS/fakeDMC/mkSimAxes.tcl +++ b/site_ansto/instrument/TEST_SICS/fakeDMC/mkSimAxes.tcl @@ -1,7 +1,7 @@ #!/usr/bin/tclsh -# $Revision: 1.5 $ -# $Date: 2007-08-16 07:06:58 $ +# $Revision: 1.6 $ +# $Date: 2007-10-31 06:10:30 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by: $Author: ffr $ @@ -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 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 TD 0 TP $enPos BG 0 SP $speed AC $acc DC $dec cntsperx $enCnts stepsperx $motor(stepsperx) PA 0 TS 44 \]"; # eval "lappend $IPtoContName($motor(host))_motors $m"; } diff --git a/site_ansto/instrument/TEST_SICS/fakeDMC/simAxis.tcl b/site_ansto/instrument/TEST_SICS/fakeDMC/simAxis.tcl index b12d5fdd..5ce22e5c 100644 --- a/site_ansto/instrument/TEST_SICS/fakeDMC/simAxis.tcl +++ b/site_ansto/instrument/TEST_SICS/fakeDMC/simAxis.tcl @@ -1,5 +1,5 @@ -# $Revision: 1.3 $ -# $Date: 2007-03-16 06:20:33 $ +# $Revision: 1.4 $ +# $Date: 2007-10-31 06:10:30 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by: $Author: ffr $ @@ -42,7 +42,6 @@ proc dmget {cmd axis} { } proc dmcall {cmd paxis} { - upvar $paxis axis; uplevel #0 eval $cmd $paxis } @@ -55,10 +54,14 @@ proc TS {axis} { proc SH {args} {} proc MO {args} {} +proc LV {args} {return "FRED=1\nBARNEY=2"} +proc TI {args} {return 240} +proc XQ {args} {return 1} proc BG {_axis} { upvar #0 $_axis axis; set axis(TS) 140; # moving, limit switches open + set axis(BG) 1; # motor is moving set timeStep 0.1; # seconds set target $axis(PA); set diff [expr $target - $axis(TD)]; @@ -77,7 +80,11 @@ proc BG {_axis} { } # Don't handle _XQ _HX -proc MG {msg} { +proc MG {args} { +# Skip formatting + if {[string index [lindex $args 0] 0] == F} { + set msg [lrange $args 1 end] + } # If msg starts with _ then return val for axis if {[string index $msg 0] == "_"} { return [evalArgList $msg]; @@ -97,16 +104,19 @@ proc every {ms body} { proc nextstep {paxis step target} { upvar #0 $paxis axis; set mult [expr double($axis(cntsperx))/$axis(stepsperx)]; - set axis(TP) [expr $step * $mult + $axis(TP)]; - set axis(TD) [expr $axis(TD) + $step]; - if {[expr abs($axis(TD) - double($target))] < 0.5} { + set axis(TP) [expr int($step * $mult + $axis(TP))]; + set TD_POS [expr int($axis(TD) + $step)]; + set axis(TD) [expr int($TD_POS)]; + if {[expr abs($TD_POS - double($target))] < 0.5} { set axis(TS) 44; # Stopped, limit switches open + set axis(BG) 0; # motor has stopped return 0; } elseif {[expr abs($target - $axis(TD)) < abs($step)]} { set diff [expr $target - $axis(TD)]; - set axis(TP) [expr round($diff*$mult + $axis(TP))]; - set axis(TD) $target; + set axis(TP) [expr int(round($diff*$mult + $axis(TP)))]; + set axis(TD) [expr int($target)]; set axis(TS) 44; # Stopped, limit switches open + set axis(BG) 0; # motor has stopped return 0; } else { return 1;