Here is a script that implements a virtual motor. Does does nothing else but else but changing a global symbol.
Before the virtual motor can be used, the following
command has to be entered: ONLINE> def vm1.
#!/usr/bin/perl -w
#
# file name: /online_dir/vm1.pl
#
# This script is a template for a virtual motor.
#
my ($method, $value_new) = @ARGV;
$Spectra::dummy_vm1 = 0 if( !defined( $Spectra::dummy_vm1));
my $status = 1;
if( $method eq "set_position")
{
$Spectra::dummy_vm1 = $value_new;
}
elsif( $method eq "get_position")
{
$SYM{RETURN_VALUE} = $Spectra::dummy_vm1;
}
elsif( $method eq "get_limit_min")
{
$SYM{RETURN_VALUE} = -100;
}
elsif( $method eq "get_limit_max")
{
$SYM{RETURN_VALUE} = 100;
}
elsif( $method eq "exec_stop")
{
Util::log( "method exec-stop");
}
else
{
Spectra::error( "vm1: failed to identify $method");
$status = 0;
goto finish;
}
finish:
$status;