Ejemplo n.º 1
0
 /** handle the connection event */
 public void connectionMade(final Channel channel) {
   try {
     if (channel == _lowerChannel) {
       _lowerMonitor = channel.addMonitorValue(this, Monitor.VALUE);
     } else if (channel == _upperChannel) {
       _upperMonitor = channel.addMonitorValue(this, Monitor.VALUE);
     }
     Channel.flushIO();
   } catch (ConnectionException exception) {
   } catch (MonitorException excepiton) {
   }
 }
Ejemplo n.º 2
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();
      }
    }
Ejemplo n.º 3
0
  /** Creates new BpmAgent */
  public BpmAgent(AcceleratorSeq aSequence, BPM newBpmNode) {

    bpmNode = newBpmNode;
    sequence = aSequence;

    xavgch = bpmNode.getChannel(BPM.X_TBT_HANDLE);
    yavgch = bpmNode.getChannel(BPM.Y_TBT_HANDLE);
    xavgch.requestConnection();
    yavgch.requestConnection();
    bpmNode.getChannel(BPM.X_AVG_HANDLE).requestConnection();
    bpmNode.getChannel(BPM.Y_AVG_HANDLE).requestConnection();
    // xavgch.setSyncRequest(true);
    // yavgch.setSyncRequest(true);
    // xavgch.connect();
    // yavgch.connect();
    // xavgch.pendIO(5);
    // yavgch.pendIO(5);
    // xavgch.setSyncRequest(false);
    // yavgch.setSyncRequest(false);
  }
Ejemplo n.º 4
0
  /** Get the horizontal TBT array * */
  public double[] getXAvgTBTArray() {
    double[] value;
    int size = 0;
    try {
      size = xavgch.elementCount();
    } catch (ConnectionException e) {
    }

    value = new double[size];

    try {
      value = xavgch.getArrDbl();
    } catch (ConnectionException e) {
      System.err.println("Unable to connect to: " + xavgch.channelName());
    } catch (GetException e) {
      System.err.println("Unable to get process variables.");
    }

    return value;
  }
Ejemplo n.º 5
0
 /** Test if the BPM node is okay */
 public boolean isConnected() {
   return xavgch.isConnected()
       && yavgch.isConnected()
       && bpmNode.getChannel(BPM.X_AVG_HANDLE).isConnected()
       && bpmNode.getChannel(BPM.Y_AVG_HANDLE).isConnected();
 }