Create fake DMC2280 controllers.
r1138 | ffr | 2006-10-13 09:06:05 +1000 (Fri, 13 Oct 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
fdd815680f
commit
572b77fac2
85
site_ansto/instrument/TEST_SICS/fakeDMC/mkSimAxes.tcl
Executable file
85
site_ansto/instrument/TEST_SICS/fakeDMC/mkSimAxes.tcl
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/tclsh
|
||||
|
||||
# $Revision: 1.1 $
|
||||
# $Date: 2006-10-12 23:06:05 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by: $Author: ffr $
|
||||
|
||||
# Creates fake DMC configuration files based on the instrument
|
||||
# configuration file.
|
||||
|
||||
proc usage {} {
|
||||
puts "mkSimAxes.tcl INSTNAME";
|
||||
puts "INSTNAME is the instrument name (eg wombat, echidna)"
|
||||
}
|
||||
|
||||
source loadConfig.tcl
|
||||
|
||||
# This implementation of the "Motor" command stores the
|
||||
# configured motor parameters in an array named
|
||||
# after the motor.
|
||||
proc Motor {name type par} {
|
||||
global motors;
|
||||
upvar #0 $par arr
|
||||
upvar #0 $name param_arr
|
||||
upvar #0 ${name}_status status
|
||||
array set param_arr [array get arr]
|
||||
|
||||
|
||||
array set status [list position "" home "" upperLim "" lowerLim "" homeTest NOTDONE limitTest NOTDONE]
|
||||
lappend motors $name
|
||||
}
|
||||
|
||||
proc mkSimMotor {args} {
|
||||
foreach m $args {
|
||||
upvar #0 $m axis;
|
||||
puts $axis(host);
|
||||
}
|
||||
}
|
||||
|
||||
proc mkSimAxes {} {
|
||||
global IPtoContName motors ContList simConts;
|
||||
array get IPtoContName;
|
||||
puts $motors;
|
||||
|
||||
foreach c $ContList {
|
||||
set simFile($c) [open ${c}_sim.tcl w];
|
||||
}
|
||||
|
||||
foreach m $motors {
|
||||
upvar #0 $m motor;
|
||||
|
||||
set nm $motor(axis);
|
||||
set ${nm}Pos 0;
|
||||
set ${nm}stepsPerX 20125;
|
||||
set speed [expr $motor(stepsPerX) * $motor(maxSpeed)]
|
||||
set acc [expr $motor(stepsPerX) * $motor(maxAccel)]
|
||||
set dec [expr $motor(stepsPerX) * $motor(maxDecel)]
|
||||
if [ info exists motor(absEnc) ] {
|
||||
set enPos $motor(absEncHome);
|
||||
set enCnts $motor(cntsPerX);
|
||||
} else {
|
||||
set enPos 0;
|
||||
set enCnts 0;
|
||||
}
|
||||
puts $simFile($IPtoContName($motor(host))) "array set $nm \[\list TD 0 TP $enPos SP $speed AC $acc DC $dec cntsPerX $enCnts stepsPerX $motor(stepsPerX) PA 0 TS 44 \]";
|
||||
|
||||
# eval "lappend $IPtoContName($motor(host))_motors $m";
|
||||
}
|
||||
|
||||
foreach c $ContList {
|
||||
close $simFile($c);
|
||||
}
|
||||
}
|
||||
|
||||
proc main {args} {
|
||||
cd ../sics/server;
|
||||
loadConfig $args;
|
||||
cd ../../fakeDMC;
|
||||
mkSimAxes;
|
||||
}
|
||||
|
||||
if {$tcl_interactive==0} {
|
||||
main ${argv}_configuration.tcl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user