Differences between revisions 1 and 2
Revision 1 as of 2007-01-04 08:32:59
Size: 3782
Editor: RanaAdhikari
Comment:
Revision 2 as of 2012-01-03 23:02:43
Size: 3782
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

{{{#!/bin/perl -w

use strict; #use EpicsTools;

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - # This PERL script watches the PSL and does some stuff. # # 1) Watches the FSS and runs the FSS Autolock if the # Refcav breaks lock. # # 2) Watches the PMC and runs the PMC Autolock script # if the PMC is out of lock. # # 3) Same, but for the MZ. All of these require that the # appropriate Lock Acquisition buttons be on. # # 4) Add the ISS to this script. # - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# setup env my $read = "tdsread"; my $write = "tdswrite"; my $step = "ezcastep"; my $switch = "ezcaswitch"; my $scripts = "/cvs/cds/caltech/scripts"; my $pezcabit = "$scripts/general/pezcabit";

my $ifo = "C1"; my $lsc = "${ifo}:LSC"; my $sus = "${ifo}:SUS"; my $ioo = "${ifo}:IOO"; my $psl = "${ifo}:PSL";

# state channel bits my $fss_bit = 0; my $pmc_bit = 1; my $mz_bit = 2; my $imc_bit = 3; my $ifo_bit = 4; my $ad_bit = 5; # not needed in this script my $omc_bit = 6; # not needed in this script

# various numbers my $ifo_state = "${ifo}:IFO-STATE";

# how are these set? my $fss_state = "${ifo}:PSL-FSS_STATE"; my $pmc_state = "${ifo}:PSL-PMC_STATE"; my $mz_state = "${ifo}:PSL-MZ_STATE";

# IFO readback channels (set by state code) my $imc_state = "${ifo}:IOO-MC_LOCK"; my $FSS_la_chan = "${psl}-FSS_LOCK"; my $PMC_la_chan = "${psl}-PMC_LOCK"; my $MZ_la_chan = "${psl}-MZ_LOCK";

# ??? my $FSS_la = 0; my $PMC_la = 0; my $MZ_la = 0;

# various commands my $dateCmd = "date";

# initalize state my $tNow = $dateCmd;

# initialize loop variables my $tDiff = 0; my $isRClocked = 0; my $isPMClocked = 0; my $isMZlocked = 0; my $isIMClocked = 0;

# main watch loop while ( 1 ) {

  • ### get some info
    • print "\n\t$tNow"; print "mz: $MZ_la";
    # check to see if the ifo_state

    $isRClocked = $read $fss_state; $isPMClocked = $read $fss_state; $isMZlocked = $read $mz_state;

    $isIMClocked = $read $imc_state; # Set IFO State Bits if ( $isRClocked == 1 ) {

    • print "FSS Locked...\n"; system("$pezcabit $ifo_state $fss_bit SET");
    } else {
    • print "FSS UN-Locked...\n"; system("$pezcabit $ifo_state $fss_bit RESET");
    } if ( $isPMClocked == 1 ) {
    • print "PMC Locked...\n"; system("$pezcabit $ifo_state $pmc_bit SET");
    } else {
    • print "PMC UN-Locked...\n"; system("$pezcabit $ifo_state $pmc_bit RESET");
    } if ( $isMZlocked == 1 ) {
    • print "Mach-Zehnder Locked...\n"; system("$pezcabit $ifo_state $mz_bit SET");
    } else {
    • print "Mach-Zehnder UN-Locked...\n"; system("$pezcabit $ifo_state $mz_bit RESET");
    } if ( $isIMClocked == 1 ) {
    • print "Mode Cleaner Locked...\n"; system("$pezcabit $ifo_state $imc_bit SET");
    } else {
    • print "Mode Cleaner UN-Locked...\n"; system("$pezcabit $ifo_state $imc_bit RESET");
    }
    • # check PSL state

      $FSS_la = $read $FSS_la_chan; $PMC_la = $read $PMC_la_chan; $MZ_la = $read $MZ_la_chan;

    if ( $isRClocked == 0 && $FSS_la == 1 ) {

    • system("sleep 5");

      $isRClocked = $read $fss_state; if ( $isRClocked == 0 && $FSS_la == 1 ) {

      • print "Running FSS Autolocker\n";

        #system("$scripts/PSL/FSS/FSSAutolock &");

      • }
    }

    if ( $isPMClocked == 0 && $PMC_la == 1 ) {

    • print "Running PMC Autolocker\n";

      #system("$scripts/PSL/PMC/PMCAutolock &");

    }

    if ( ($isMZlocked == 0) && ($MZ_la == 1) ) {

    • print "Running MZ Autolocker\n";

      #system("$scripts/PSL/MZ/lockMZ &");

    }
    • $tNow = $dateCmd;

} }}}

PSLwatch_script (last edited 2012-01-03 23:02:43 by localhost)