Reworking the Knauer
This commit is contained in:
@@ -10,7 +10,7 @@ driver knauer_pump = {
|
|||||||
#
|
#
|
||||||
group dummy = {
|
group dummy = {
|
||||||
type = text; readable = 1; data = false; control = false; nxsave = false;
|
type = text; readable = 1; data = false; control = false; nxsave = false;
|
||||||
var status = { read_command = 'STATUS?'; read_function = read_status; }
|
var status = { read_command = 'STATUS?'; read_function = read_status; property real_data = ' '; }
|
||||||
var glp = { read_command = 'GLP?'; read_function = read_glp; property real_data = ' '; }
|
var glp = { read_command = 'GLP?'; read_function = read_glp; property real_data = ' '; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +33,8 @@ driver knauer_pump = {
|
|||||||
read_command = ' ';
|
read_command = ' ';
|
||||||
fetch_function = status_fetch;
|
fetch_function = status_fetch;
|
||||||
}
|
}
|
||||||
var volume_pv = {
|
group volume = {
|
||||||
|
var pval = {
|
||||||
type = float;
|
type = float;
|
||||||
readable = 1;
|
readable = 1;
|
||||||
read_command = ' ';
|
read_command = ' ';
|
||||||
@@ -41,12 +42,12 @@ driver knauer_pump = {
|
|||||||
#checkrange_function = volume_reject;
|
#checkrange_function = volume_reject;
|
||||||
property 'units' = 'mL';
|
property 'units' = 'mL';
|
||||||
}
|
}
|
||||||
var pump_sp = {
|
var setp = {
|
||||||
type = float;
|
type = float;
|
||||||
writeable = 1;
|
writeable = 1;
|
||||||
write_command = ' ';
|
write_command = ' ';
|
||||||
write_function = pump_write;
|
write_function = pump_write;
|
||||||
driveable = pump/volume_pv;
|
driveable = pump/volume/pval;
|
||||||
checkstatus_function = pump_checkstatus;
|
checkstatus_function = pump_checkstatus;
|
||||||
halt_function = pump_halt;
|
halt_function = pump_halt;
|
||||||
lowerlimit = 0; upperlimit = 100; tolerance = 0.01;
|
lowerlimit = 0; upperlimit = 100; tolerance = 0.01;
|
||||||
@@ -56,37 +57,27 @@ driver knauer_pump = {
|
|||||||
property 'units' = 'mL';
|
property 'units' = 'mL';
|
||||||
property this_state = 0;
|
property this_state = 0;
|
||||||
}
|
}
|
||||||
var volume_sp = {
|
|
||||||
type = float;
|
|
||||||
writeable = 1;
|
|
||||||
write_command = ' ';
|
|
||||||
write_function = volume_write;
|
|
||||||
driveable = pump/volume_pv;
|
|
||||||
checkstatus_function = volume_checkstatus;
|
|
||||||
halt_function = volume_halt;
|
|
||||||
lowerlimit = 0; upperlimit = 100; tolerance = 0.01;
|
|
||||||
readable = 1;
|
|
||||||
read_command = ' ';
|
|
||||||
fetch_function = volume_checkpumping;
|
|
||||||
property 'units' = 'mL';
|
|
||||||
}
|
}
|
||||||
var ratio_pv = {
|
group ratio = {
|
||||||
|
var pval = {
|
||||||
type = text;
|
type = text;
|
||||||
readable = 1; read_command = ' '; fetch_function = ratios_fetch;
|
readable = 1; read_command = ' '; fetch_function = ratio_fetch;
|
||||||
property 'units' = 'percent';
|
property 'units' = 'percent';
|
||||||
}
|
}
|
||||||
var ratio_sp = {
|
var setp = {
|
||||||
type = text;
|
type = text;
|
||||||
value = '25/25/25/25';
|
value = '25/25/25/25';
|
||||||
writeable = 1; write_command = ' '; write_function = ratios_write; checkrange_function = ratios_check;
|
writeable = 1; write_command = ' '; write_function = ratio_write; checkrange_function = ratio_check;
|
||||||
property 'units' = 'percent';
|
property 'units' = 'percent';
|
||||||
}
|
}
|
||||||
var flow_pv = {
|
}
|
||||||
|
group flow = {
|
||||||
|
var pval = {
|
||||||
type = float;
|
type = float;
|
||||||
readable = 1; read_command = ' '; fetch_function = flow_fetch;
|
readable = 1; read_command = ' '; fetch_function = flow_fetch;
|
||||||
property 'units' = 'mL/min';
|
property 'units' = 'mL/min';
|
||||||
}
|
}
|
||||||
var flow_sp = {
|
var setp = {
|
||||||
type = float;
|
type = float;
|
||||||
value = 1.0;
|
value = 1.0;
|
||||||
writeable = 1; write_command = ' '; write_function = flow_write;
|
writeable = 1; write_command = ' '; write_function = flow_write;
|
||||||
@@ -94,8 +85,9 @@ driver knauer_pump = {
|
|||||||
property 'units' = 'mL/min';
|
property 'units' = 'mL/min';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
group stuff = {
|
group grp_stuff = {
|
||||||
readable = 600;
|
readable = 600;
|
||||||
type = text;
|
type = text;
|
||||||
data = false; control = false; nxsave = false;
|
data = false; control = false; nxsave = false;
|
||||||
@@ -124,7 +116,7 @@ driver knauer_pump = {
|
|||||||
var 'units' = { read_command = 'UNITS?'; }
|
var 'units' = { read_command = 'UNITS?'; }
|
||||||
var valves = { read_command = 'VALVES?'; }
|
var valves = { read_command = 'VALVES?'; }
|
||||||
}
|
}
|
||||||
group glp = {
|
group grp_glp = {
|
||||||
type = text;
|
type = text;
|
||||||
readable = 1;
|
readable = 1;
|
||||||
fetch_function = fetch_from_glp;
|
fetch_function = fetch_from_glp;
|
||||||
@@ -142,7 +134,7 @@ driver knauer_pump = {
|
|||||||
var pump_pwrhi = { read_command = '12'; }
|
var pump_pwrhi = { read_command = '12'; }
|
||||||
var pump_pwrlo = { read_command = '13'; }
|
var pump_pwrlo = { read_command = '13'; }
|
||||||
}
|
}
|
||||||
group status = {
|
group grp_status = {
|
||||||
type = text;
|
type = text;
|
||||||
readable = 1;
|
readable = 1;
|
||||||
fetch_function = fetch_from_status;
|
fetch_function = fetch_from_status;
|
||||||
@@ -167,6 +159,24 @@ driver knauer_pump = {
|
|||||||
var error_in = { read_command = '19'; }
|
var error_in = { read_command = '19'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Ensure the pump starts up in REMOTE mode
|
||||||
|
#
|
||||||
|
code mkDriver = {%%
|
||||||
|
hset ${scobj_hpath}/pump/remote 1
|
||||||
|
%%}
|
||||||
|
#
|
||||||
|
# These functions handle the real_data returned by the pump for the GLP? command
|
||||||
|
#
|
||||||
|
code read_glp = {%%
|
||||||
|
if { [string equal -nocase -length 6 ${data} "ERROR:"] } {
|
||||||
|
} else {
|
||||||
|
set dlist [split [lindex [split ${data} ":"] 1] ","]
|
||||||
|
sct real_data "[join [lrange ${dlist} 0 end] ,]"
|
||||||
|
set data "Hidden in real_data property"
|
||||||
|
}
|
||||||
|
%%}
|
||||||
|
|
||||||
code fetch_from_glp = {%%
|
code fetch_from_glp = {%%
|
||||||
set index ${cmd_str}
|
set index ${cmd_str}
|
||||||
set data [hgetpropval ${tc_root}/dummy/glp real_data]
|
set data [hgetpropval ${tc_root}/dummy/glp real_data]
|
||||||
@@ -179,6 +189,15 @@ driver knauer_pump = {
|
|||||||
set cmd "@@NOSEND@@"
|
set cmd "@@NOSEND@@"
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
|
#
|
||||||
|
# These functions handle the real_data returned by the pump for the STATUS? command
|
||||||
|
#
|
||||||
|
code read_status = {%%
|
||||||
|
set dlist [split [lindex [split ${data} ":"] 1] ","]
|
||||||
|
sct real_data "[join [lrange ${dlist} 0 end] ,]"
|
||||||
|
set data "Hidden in real_data property"
|
||||||
|
%%}
|
||||||
|
|
||||||
code fetch_from_status = {%%
|
code fetch_from_status = {%%
|
||||||
set index ${cmd_str}
|
set index ${cmd_str}
|
||||||
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
||||||
@@ -191,19 +210,9 @@ driver knauer_pump = {
|
|||||||
set cmd "@@NOSEND@@"
|
set cmd "@@NOSEND@@"
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
code read_glp = {%%
|
#
|
||||||
if { [string equal -nocase -length 6 ${data} "ERROR:"] } {
|
# Decode the status from the real_data to PUMPING if it is pumping else IDLE
|
||||||
} else {
|
#
|
||||||
set dlist [split [lindex [split ${data} ":"] 1] ","]
|
|
||||||
sct real_data "[join [lrange ${dlist} 0 end] ,]"
|
|
||||||
set data "Hidden in real_data property"
|
|
||||||
}
|
|
||||||
%%}
|
|
||||||
code read_status = {%%
|
|
||||||
set dlist [split [lindex [split ${data} ":"] 1] ","]
|
|
||||||
sct real_data "[join [lrange ${dlist} 0 end] ,]"
|
|
||||||
set data "Hidden in real_data property"
|
|
||||||
%%}
|
|
||||||
code status_fetch = {%%
|
code status_fetch = {%%
|
||||||
set index 1
|
set index 1
|
||||||
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
||||||
@@ -216,11 +225,19 @@ driver knauer_pump = {
|
|||||||
sct result "IDLE"
|
sct result "IDLE"
|
||||||
}
|
}
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Decode the state from the real_data to one of the documented strings
|
||||||
|
#
|
||||||
code state_fetch = {%%
|
code state_fetch = {%%
|
||||||
set index 1
|
set index 1
|
||||||
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
||||||
set dlist [split ${data} ","]
|
set dlist [split ${data} ","]
|
||||||
|
if { [llength ${dlist}] > ${index} } {
|
||||||
set state_code [lindex ${dlist} ${index}]
|
set state_code [lindex ${dlist} ${index}]
|
||||||
|
} else {
|
||||||
|
set state_code "0"
|
||||||
|
}
|
||||||
set cmd "@@NOSEND@@"
|
set cmd "@@NOSEND@@"
|
||||||
if { ${state_code} < 0 || ${state_code} > 9 } {
|
if { ${state_code} < 0 || ${state_code} > 9 } {
|
||||||
sct geterror "Invalid device_state ${state_code}"
|
sct geterror "Invalid device_state ${state_code}"
|
||||||
@@ -239,16 +256,17 @@ driver knauer_pump = {
|
|||||||
sct result [lindex ${slist} ${state_code}]
|
sct result [lindex ${slist} ${state_code}]
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
code halt = {%%
|
#
|
||||||
set rlist [hval ${tc_root}/pump/ratio_sp]
|
#
|
||||||
set ratio_tgt [join [split ${rlist} /] ,]
|
|
||||||
set cmd "RAMP:0,0,${ratio_tgt},0,0,0,0,0,0,0,0,2"
|
|
||||||
%%}
|
|
||||||
|
|
||||||
code flow_fetch = {%%
|
code flow_fetch = {%%
|
||||||
|
set index 4
|
||||||
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
||||||
set dlist [split ${data} ","]
|
set dlist [split ${data} ","]
|
||||||
|
if { [llength ${dlist}] > ${index} } {
|
||||||
set flow_pv [lindex ${dlist} 4]
|
set flow_pv [lindex ${dlist} 4]
|
||||||
|
} else {
|
||||||
|
set flow_pv 0.0
|
||||||
|
}
|
||||||
sct result [expr {0.001 * ${flow_pv}}]
|
sct result [expr {0.001 * ${flow_pv}}]
|
||||||
set cmd "@@NOSEND@@"
|
set cmd "@@NOSEND@@"
|
||||||
%%}
|
%%}
|
||||||
@@ -264,7 +282,9 @@ driver knauer_pump = {
|
|||||||
}
|
}
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
code ratios_check = {%%
|
#
|
||||||
|
#
|
||||||
|
code ratio_check = {%%
|
||||||
set rlist [split ${setpoint} /]
|
set rlist [split ${setpoint} /]
|
||||||
if { [llength ${rlist}] != 4 } {
|
if { [llength ${rlist}] != 4 } {
|
||||||
sct geterror "${setpoint} has [llength ${rlist}] components, needs 4"
|
sct geterror "${setpoint} has [llength ${rlist}] components, needs 4"
|
||||||
@@ -277,14 +297,14 @@ driver knauer_pump = {
|
|||||||
}
|
}
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
code ratios_fetch = {%%
|
code ratio_fetch = {%%
|
||||||
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
set data [hgetpropval ${tc_root}/dummy/status real_data]
|
||||||
set dlist [split ${data} ","]
|
set dlist [split ${data} ","]
|
||||||
set ratio_vals "[lindex ${dlist} 5]/[lindex ${dlist} 6]/[lindex ${dlist} 7]/[lindex ${dlist} 8]"
|
set ratio_vals "[lindex ${dlist} 5]/[lindex ${dlist} 6]/[lindex ${dlist} 7]/[lindex ${dlist} 8]"
|
||||||
sct result ${ratio_vals}
|
sct result ${ratio_vals}
|
||||||
set cmd "@@NOSEND@@"
|
set cmd "@@NOSEND@@"
|
||||||
%%}
|
%%}
|
||||||
code ratios_write = {%%
|
code ratio_write = {%%
|
||||||
set data [sct target]
|
set data [sct target]
|
||||||
set cmd "@@NOSEND@@"
|
set cmd "@@NOSEND@@"
|
||||||
set nextState idle
|
set nextState idle
|
||||||
@@ -296,6 +316,8 @@ driver knauer_pump = {
|
|||||||
}
|
}
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
code remote_read = {%%
|
code remote_read = {%%
|
||||||
if { [string equal -length 7 ${data} "REMOTE:"] } {
|
if { [string equal -length 7 ${data} "REMOTE:"] } {
|
||||||
set data [lindex [split ${data} :] 1]
|
set data [lindex [split ${data} :] 1]
|
||||||
@@ -313,6 +335,8 @@ driver knauer_pump = {
|
|||||||
}
|
}
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
code volume_fetch = {%%
|
code volume_fetch = {%%
|
||||||
set data [hgetpropval ${tc_root}/dummy/glp real_data]
|
set data [hgetpropval ${tc_root}/dummy/glp real_data]
|
||||||
set dlist [split ${data} ","]
|
set dlist [split ${data} ","]
|
||||||
@@ -351,8 +375,8 @@ driver knauer_pump = {
|
|||||||
|
|
||||||
code pump_fetch = {%%
|
code pump_fetch = {%%
|
||||||
if { [sct this_state] > 0 } {
|
if { [sct this_state] > 0 } {
|
||||||
set flow_tgt [expr {int(1000.0 * [hval ${tc_root}/pump/flow_sp])}]
|
set flow_tgt [expr {int(1000.0 * [hval ${tc_root}/pump/flow/setp])}]
|
||||||
set ratio_tgt [join [split [hval ${tc_root}/pump/ratio_sp] /] ,]
|
set ratio_tgt [join [split [hval ${tc_root}/pump/ratio/setp] /] ,]
|
||||||
set time_tgt [expr {int(60000.0 * 1000.0 * [sct target] / ${flow_tgt})}]
|
set time_tgt [expr {int(60000.0 * 1000.0 * [sct target] / ${flow_tgt})}]
|
||||||
set time_1 [expr {${time_tgt} - 500}]
|
set time_1 [expr {${time_tgt} - 500}]
|
||||||
set time_2 [expr {${time_tgt} + 500}]
|
set time_2 [expr {${time_tgt} + 500}]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user