Ejemplo n.º 1
0
 /** Request a connection to the book channel. */
 protected void requestBookConnection() {
   try {
     final Channel bookChannel = getNode().getChannel(MagnetMainSupply.FIELD_BOOK_HANDLE);
     bookChannel.requestConnection();
   } catch (NoSuchChannelException exception) {
   } // not important at this point
 }
Ejemplo n.º 2
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.º 3
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.º 4
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.º 5
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.º 6
0
  /**
   * Get the field in this electromagnet via ca.
   *
   * @return the readback field in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
   */
  public double getFieldReadback() throws ConnectionException, GetException {
    Channel fieldRBChannel = getAndConnectChannel(FIELD_RB_HANDLE);

    return toFieldFromCA(fieldRBChannel.getValDbl());
  }
Ejemplo n.º 7
0
 public double getMainFieldSetting(final Electromagnet magnet) {
   final Channel channel = magnet.getChannel(MagnetMainSupply.FIELD_SET_HANDLE);
   return _dataSource.getChannelSnapshotValue(channel.channelName())[0];
 }
Ejemplo n.º 8
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();
 }