The following lines of code create a FMB widget including the calibration constants. A figure of the widget is displayed below.
#
# part of /online_dir/TkIrc.pl
#
$Spc::res_h{ blsc} = "fmb";
$Spc::res_h{ fmb_title} = { text => "FMB DC Monochromator"};
$Spc::res_h{ fmb_help} = sub
{
Util::display_text( "Help MC",
'
Some Help text
'
)};
$Spc::res_h{ fmb_cmpnd} = { name => "energyfmb", unit => "eV"};
#
# the motors
#
$Spc::res_h{ fmb_m1} = { name => "Dcm_Bragg", unit => "Deg"};
$Spc::res_h{ fmb_m2} = { name => "Dcm_Parallel", unit => "mm"};
$Spc::res_h{ fmb_m3} = { name => "Dcm_Perp", unit => "mm"};
#
# the calibration units
#
$Spc::res_h{ fmb_io1} = {
label => {
name => "CalBragg",
get => sub { sprintf( "%g", Spectra::tng_attrDoubleRd( "dcm_bragg", "UnitCalibration"));},
unit => "Deg"},
entry => {
set => sub { Spectra::tng_attrDoubleWrt( "dcm_bragg", "UnitCalibration", $_[0])}}};
$Spc::res_h{ fmb_io2} = {
label => {
name => "CalParallel",
get => sub { sprintf( "%g", Spectra::tng_attrDoubleRd( "dcm_parallel", "UnitCalibration"));},
unit => "mm"},
entry => {
set => sub { Spectra::tng_attrDoubleWrt( "dcm_parallel", "UnitCalibration", $_[0])}}};
$Spc::res_h{ fmb_io3} = {
label => {
name => "CalPerp",
get => sub { sprintf( "%g", Spectra::tng_attrDoubleRd( "dcm_perp", "UnitCalibration"));},
unit => "mm"},
entry => {
set => sub { Spectra::tng_attrDoubleWrt( "dcm_perp", "UnitCalibration", $_[0])}}};
The 'Test' button works as follows. A value is inserted in the fmbenergy entry widget. If 'Test' is pressed, the target positions of the axes are displayed in the log window of the toplevel widget.
Calibration: the FMB is calibrated by supplying a value to the fmbenergy entry widget, followed by an 'Options' - 'Calibrate' action. Calibrations change the axes offsets. Consider to take a note of the old offsets before a new calibration is done.
The FMB uses 4 motors (3 axes and the fmbenery) that need to be defined in /online_dir/online.xml:
... <device> <name>energyfmb</name> <type>type_tango</type> <module>motor_tango</module> <device>pXX/dcmener/oh.01</device> <control>tango</control> <hostname>hasppXXoh1:10000</hostname> </device> <device> <name>dcm_bragg</name> <type>type_tango</type> <module>motor_tango</module> <device>pXX/dcmmotor/oh.01</device> <control>tango</control> <hostname>hasppXXoh1:10000</hostname> </device> <device> <name>dcm_parallel</name> <type>type_tango</type> <module>motor_tango</module> <device>pXX/dcmmotor/oh.04</device> <control>tango</control> <hostname>hasppXXoh1:10000</hostname> </device> <device> <name>dcm_perp</name> <type>type_tango</type> <module>motor_tango</module> <device>pXX/dcmmotor/oh.03</device> <control>tango</control> <hostname>hasppXXoh1:10000</hostname> </device> ...