Ejemplo n.º 1
0
 /** Get the average vertical position reading from the last turn * */
 public double getYAvg() {
   double yavg = 0.0;
   try {
     yavg = bpmNode.getYAvg();
   } catch (ConnectionException e) {
     System.out.println("Could not connect with:" + bpmNode.getId());
   } catch (GetException e) {
     System.out.println("Could not get value from:" + bpmNode.getId());
   }
   return yavg;
 }
Ejemplo n.º 2
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.º 3
0
  /** Test whether the BPM's xAvg, yAvg and ampAvg channels can connect */
  public static boolean nodeCanConnect(BPM bpm) {
    boolean canConnectx = true;
    boolean canConnecty = true;
    boolean canConnect = false;
    try {
      // canConnect = canConnect && bpm.getChannel(BPM.X_TBT_HANDLE).connect();
      // canConnect = canConnect && bpm.getChannel(BPM.Y_TBT_HANDLE).connect();
      canConnectx = bpm.getChannel(BPM.X_TBT_HANDLE).connectAndWait();
      canConnectx = bpm.getChannel(BPM.Y_TBT_HANDLE).connectAndWait();
      // canConnect = canConnect && bpm.getChannel(BPM.AMP_AVG_HANDLE).connect();
    } catch (NoSuchChannelException excpt) {
      if (!canConnectx || !canConnecty) {
        canConnect = false;
      }
    }

    return canConnect;
  }
Ejemplo n.º 4
0
 /** Test whether the given BPM node has a good status and all its channels can connect */
 public static boolean isOkay(BPM bpm) {
   return bpm.getStatus();
 }
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();
 }
Ejemplo n.º 6
0
 /** Name of the BPM as given by its unique ID */
 public String name() {
   return bpmNode.getId();
 }