This subsection gives a simple example of an implementation
of an automatic absorber procedure.
The main code is part of Online. It calls functions
that are supplied by the user, normally in
/online_dir/TkIrc.pl
:
Filter::set( $value)
Changes the absorber
thickness.
Filter::get()
Returns the absorber thickness.
Filter::signal()
Returns the signal.
Filter::absorption()
Returns the absorption factor
( == 1, if no filter is in the beam).
In addition the following symbols have to be provided by the user:
$Filter::signal_min
, $Filter::signal_max
The procedure tries to
keep the signal between the limits by changing the absorber.
$Filter::filter_min
, $Filter::filter_max
The
limits for the absorber position.
$Filter::delta
The absober is changed by this quantity.
In our example a motor, mot54, is moved in the range from 20 to 30
to keep the
signal between 1000 and 5000 counts. The position of the motor is
changed by 0.5 units. The signal comes from c1
which
is gated by t1
. The sample time is 0.1 s:
package Filter; use vars qw( $signal_min $signal_max $delta $filter_max $filter_min); $delta = 0.5; ( $signal_min, $signal_max) = (1000, 5000); ( $filter_min, $filter_max) = ( 20, 30); sub set { return Spectra::move( mot54 => $_[0]); } sub get { return Spectra::gmup( "mot54"); } sub signal { return (Spectra::vfc( "c1", "t1", 0.1)*10); } sub absorption { my $ret = Filter::get(); return( POSIX::exp( $ret)); }