Beispiel #1
0
    /** set a new channel whose limits we wish to monitor */
    public void setChannel(final Channel channel) {
      synchronized (this) {
        if (_lowerChannel != null) {
          _lowerChannel.removeConnectionListener(this);
          if (_lowerMonitor != null) {
            _lowerMonitor.clear();
            _lowerMonitor = null;
          }
        }

        final String lowerLimitPV = channel.channelName() + ".LOPR";
        _lowerChannel = ChannelFactory.defaultFactory().getChannel(lowerLimitPV);
        _lowerChannel.addConnectionListener(this);
        _lowerChannel.requestConnection();

        if (_upperChannel != null) {
          _upperChannel.removeConnectionListener(this);
          if (_upperMonitor != null) {
            _upperMonitor.clear();
            _upperMonitor = null;
          }
        }

        final String upperLimitPV = channel.channelName() + ".HOPR";
        _upperChannel = ChannelFactory.defaultFactory().getChannel(upperLimitPV);
        _upperChannel.addConnectionListener(this);
        _upperChannel.requestConnection();
      }
    }
Beispiel #2
0
  private synchronized void saveHOMStates() {
    ch1 = new Channel[rfCavs.size()];
    ch2 = new Channel[rfCavs.size()];
    hom0States = new int[rfCavs.size()];
    hom1States = new int[rfCavs.size()];

    ChannelFactory cf = ChannelFactory.defaultFactory();

    Iterator<SCLCavity> it = rfCavs.iterator();
    int i = 0;

    while (it.hasNext()) {
      // get HOM monitor states
      String cavName = ((AcceleratorNode) it.next()).getId();
      String chName0 = cavName.replaceAll("RF:Cav", "LLRF:HPM").concat(":HBADC0_Ctl");
      String chName1 = cavName.replaceAll("RF:Cav", "LLRF:HPM").concat(":HBADC1_Ctl");
      ch1[i] = cf.getChannel(chName0);
      ch2[i] = cf.getChannel(chName1);

      try {
        hom0States[i] = Integer.parseInt(ch1[i].getValueRecord().stringValue());
        hom1States[i] = Integer.parseInt(ch2[i].getValueRecord().stringValue());
      } catch (ConnectionException ce) {
        System.out.println("Cannot connect to a channel!");
      } catch (GetException ge) {
        System.out.println("Cannot get a channel value!");
      }

      i++;
    }
    finished1 = true;
    this.notify();
  }