Pullback from Wombat 2015-04-17

This commit is contained in:
Douglas Clowes
2015-04-17 13:12:42 +10:00
parent 25d73eb17a
commit f2568b681d
3 changed files with 232 additions and 168 deletions

View File

@ -1,166 +1,230 @@
# cf commands for driving sample environment # cf commands for driving sample environment
# ajs feb 2015 # ajs feb 2015
# cf namespace # cf namespace
# assumes tc1 and tc2 are the cf8 336 and 340 lakeshores for now # assumes tc1 and tc2 are the cf8 336 and 340 lakeshores for now
namespace eval cf { namespace eval cf {
variable wall_lag 10 variable wall_lag 10
variable wall_max 300 variable wall_max 200
variable sample_tolerance 5 variable sample_tolerance 5
variable wall_tolerance 5 variable wall_tolerance 5
variable wall_set true variable wall_set true
variable base_set true variable base_set true
variable base_control true variable base_control true
variable wall_control true variable wall_control true
proc UseWall {_wall_set _wall_control} { proc UseWall {_wall_set _wall_control} {
variable wall_set variable wall_set
variable wall_control variable wall_control
if {$_wall_set == false} {set wall_set false} else {set wall_set true} if {$_wall_set == false} {set wall_set false} else {set wall_set true}
if {$_wall_control == false} {set wall_control false} else {set wall_control true} if {$_wall_control == false} {set wall_control false} else {set wall_control true}
} }
proc UseBase {_base_set _base_control} { proc UseBase {_base_set _base_control} {
variable base_set variable base_set
variable base_control variable base_control
if {$_base_set == false} {set base_set false} else {set base_set true} if {$_base_set == false} {set base_set false} else {set base_set true}
if {$_base_control == false} {set base_control false} else {set base_control true} if {$_base_control == false} {set base_control false} else {set base_control true}
} }
proc RampOn {rate} {
proc WallParams {_wall_lag _wall_max _wall_tolerance} { variable base_set
variable wall_lag variable wall_set
variable wall_max
variable wall_tolerance hset /sample/tc1/control/ramp_Loop_1 1,$rate
set wall_lag $_wall_lag if {$base_set} {hset /sample/tc1/control/ramp_Loop_2 1,$rate}
set wall_max $_wall_max if {$wall_set} {hset /sample/tc2/control/ramp_Loop_1 1,$rate}
set wall_tolerance $_wall_tolerance wait 5
hset /sample/tc2/control/tolerance1 $wall_tolerance }
}
proc RampOff {} {
proc TempSet {temp} { variable base_set
variable wall_lag variable wall_set
variable wall_max
variable base_set hset /sample/tc1/control/ramp_Loop_1 0,5
variable wall_set if {$base_set} {hset /sample/tc1/control/ramp_Loop_2 0,5}
set tempc [expr {$temp - $wall_lag}] if {$wall_set} {hset /sample/tc2/control/ramp_Loop_1 0,5}
if {$tempc < 4} {set tempc 4} wait 5
if {$tempc > $wall_max} {set tempc $wall_max}
hset /sample/tc1/sensor/setpoint1 $temp }
if {$base_set} {hset /sample/tc1/sensor/setpoint2 $tempc}
if {$wall_set} {hset /sample/tc2/sensor/setpoint1 $tempc}
} proc WallParams {_wall_lag _wall_max _wall_tolerance} {
variable wall_lag
proc TempDrive {temp} { variable wall_max
variable wall_lag variable wall_tolerance
variable wall_max set wall_lag $_wall_lag
variable base_control set wall_max $_wall_max
variable wall_control set wall_tolerance $_wall_tolerance
TempSet $temp hset /sample/tc2/control/tolerance1 $wall_tolerance
set tempc [expr {$temp - $wall_lag}] }
if {$tempc < 4} {set tempc 4}
if {$tempc > $wall_max} {set tempc $wall_max} proc TempSet {temp} {
set drstr "drive tc1_driveable \$temp" variable wall_lag
if {$base_control} {append drstr " tc1_driveable2 \$tempc"} variable wall_max
if {$wall_control} {append drstr " tc2_driveable \$tempc"} variable base_set
eval $drstr variable wall_set
} set tempc [expr {$temp - $wall_lag}]
if {$tempc < 4} {set tempc 4}
proc Tolerance {sample} { if {$tempc > $wall_max} {set tempc $wall_max}
hset /sample/tc1/control/tolerance1 $sample hset /sample/tc1/sensor/setpoint1 $temp
hset /sample/tc1/control/tolerance2 $sample if {$base_set} {hset /sample/tc1/sensor/setpoint2 $temp}
} if {$wall_set} {hset /sample/tc2/sensor/setpoint1 $tempc}
}
proc MakeCold {} {
variable sample_tolerance proc TempDrive {temp} {
variable wall_tolerance variable wall_lag
Tolerance 20 variable wall_max
hset /sample/tc2/control/tolerance1 20 variable base_control
hset /sample/tc2/sensor/setpoint1 4 variable wall_control
TempDrive 4 TempSet $temp
Tolerance $sample_tolerance set tempc [expr {$temp - $wall_lag}]
hset /sample/tc2/control/tolerance1 $wall_tolerance if {$tempc < 4} {set tempc 4}
wait 300 if {$tempc > $wall_max} {set tempc $wall_max}
} set drstr "drive tc1_driveable \$temp"
if {$base_control} {append drstr " tc1_driveable2 \$temp"}
if {$wall_control} {append drstr " tc2_driveable \$tempc"}
proc TempRun {temp delay numsteps oscno} { eval $drstr
TempDrive $temp }
wait $delay
newfile HISTOGRAM_XY proc Tolerance {sample} {
for {set i 0} {$i < $numsteps} {incr i} { hset /sample/tc1/control/tolerance1 $sample
oct oscillate_count $oscno hset /sample/tc1/control/tolerance2 $sample
oct oscillate start }
hmm countblock
save $i proc MakeCold {} {
} variable sample_tolerance
} variable wall_tolerance
Tolerance 20
proc RampRun {start step fin oscno delay} { hset /sample/tc2/control/tolerance1 20
histmem mode unlimited hset /sample/tc2/sensor/setpoint1 4
newfile HISTOGRAM_XY TempDrive 4
set loopvar 1 Tolerance $sample_tolerance
set i 0 hset /sample/tc2/control/tolerance1 $wall_tolerance
while {$loopvar} { wait 300
set j [expr {$i*$step+$start}] }
if {$j> $fin && $step > 0} {break}
if {$j< $fin && $step < 0} {break}
TempSet $j proc TempRun {temp delay numsteps oscno} {
wait $delay RampOff
oct oscillate_count $oscno TempDrive $temp
oct oscillate start wait $delay
hmm countblock newfile HISTOGRAM_XY
save $i for {set i 0} {$i < $numsteps} {incr i} {
incr i oct oscillate_count $oscno
} oct oscillate start
} hmm countblock
save $i
proc StepRun {start step fin oscno delay} { }
histmem mode unlimited }
newfile HISTOGRAM_XY
set loopvar 1 proc StepRun {start step fin oscno delay} {
set i 0 RampOff
while {$loopvar} { histmem mode unlimited
set j [expr {$i*$step+$start}] newfile HISTOGRAM_XY
if {$j> $fin && $step > 0} {break} set loopvar 1
if {$j< $fin && $step < 0} {break} set i 0
TempDrive $j while {$loopvar} {
wait $delay set j [expr {$i*$step+$start}]
oct oscillate_count $oscno if {$j> $fin && $step > 0} {break}
oct oscillate start if {$j< $fin && $step < 0} {break}
hmm countblock TempSet $j
save $i wait $delay
incr i oct oscillate_count $oscno
} oct oscillate start
} hmm countblock
save $i
proc HeaterOn {} { incr i
variable base_set }
variable wall_set }
hset /sample/tc1/heater/heaterRange_1 4 proc StepWaitRun {start step fin oscno delay} {
if {$base_set} {hset /sample/tc1/heater/heaterRange_2 4} RampOff
if {$wall_set} {hset /sample/tc2/heater/heaterRange 5} histmem mode unlimited
} newfile HISTOGRAM_XY
set loopvar 1
proc GetTemp {} { set i 0
variable base_set while {$loopvar} {
set t1top [hget /sample/tc1/sensor/sensorValueA] set j [expr {$i*$step+$start}]
broadcast "sample top : $t1top" if {$j> $fin && $step > 0} {break}
if {$base_set} { if {$j< $fin && $step < 0} {break}
set t1base [hget /sample/tc1/sensor/sensorValueB] TempDrive $j
broadcast "sample base: $t1base" wait $delay
} oct oscillate_count $oscno
set t1wall [hget /sample/tc2/sensor/sensorValueA] oct oscillate start
broadcast "sample wall: $t1wall" hmm countblock
} save $i
incr i
}
}
namespace export *
namespace ensemble create
} proc RampRun {start rate fin oscno} {
publish cf user RampOff
TempSet $start
wait 5
set tim1 [clock seconds]
set tlength [expr abs($start-$fin)/($rate/60.0)]
broadcast $rate $tlength
RampOn $rate
wait 5
TempSet $fin
set bool 0
set i 0
histmem mode unlimited
newfile HISTOGRAM_XY
while {$bool==0} {
oct oscillate_count $oscno
oct oscillate start
hmm countblock
save $i
incr i
set tim2 [expr [clock seconds]-$tim1]
broadcast $tim2
if {$tim2>$tlength} {set bool 1}
}
RampOff
}
proc HeaterOn {} {
variable base_set
variable wall_set
hset /sample/tc1/heater/heaterRange_1 4
if {$base_set} {hset /sample/tc1/heater/heaterRange_2 4}
if {$wall_set} {hset /sample/tc2/heater/heaterRange 5}
}
proc HeaterOff {} {
variable base_set
variable wall_set
hset /sample/tc1/heater/heaterRange_1 0
if {$base_set} {hset /sample/tc1/heater/heaterRange_2 0}
if {$wall_set} {hset /sample/tc2/heater/heaterRange 0}
}
proc GetTemp {} {
variable base_set
set t1top [hget /sample/tc1/sensor/sensorValueA]
broadcast "sample top : $t1top"
if {$base_set} {
set t1base [hget /sample/tc1/sensor/sensorValueB]
broadcast "sample base: $t1base"
}
set t1wall [hget /sample/tc2/sensor/sensorValueA]
broadcast "sample wall: $t1wall"
}
namespace export *
namespace ensemble create
}
publish cf user

View File

@ -28,7 +28,7 @@ proc ::histogram_memory::init_OAT_TABLE {args} {
hmm configure fat_frame_source INTERNAL hmm configure fat_frame_source INTERNAL
set resolution "double_x" # set resolution "double_x"
switch $resolution { switch $resolution {
"hires" { "hires" {

View File

@ -97,7 +97,7 @@ SetVoltScale 1000.0
# LS336 02 at 205.29 # LS336 02 at 205.29
# add_sct_ls336 tc2 10.157.205.30 7777 "\r\n" 1.0 1.0 # add_sct_ls336 tc2 10.157.205.30 7777 "\r\n" 1.0 1.0
# add_sct_ls336 tc1 10.157.205.31 7777 "\r\n" 1.0 1.0 # add_sct_ls336 tc1 10.157.205.31 7777 "\r\n" 1.0 1.0
# add_sct_ls340 tc3 137.157.201.86 4001 "\r\n" 1.0 1.0 # add_sct_ls340 tc3 137.157.201.86 4002 "\r\n" 1.0 1.0
server_init server_init
########################################### ###########################################