Exemplo 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;
 }
Exemplo 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);
  }
Exemplo n.º 3
0
  /** Load the bpms from the selected sequence and construct the BPM agents. */
  public void loadBPMs() {
    if (_sequence == null) {
      AVAILABLE_BPM_AGENTS.clear();
      _bpmAgents = new ArrayList<BpmAgent>();
      BEAM_EXCURSION_ORBIT_ADAPTOR.setBPMAgents(_bpmAgents);
    } else {
      final List<BPM> allBPMs = _sequence.getAllNodesOfType(BPM.s_strType);
      final List<BPM> bpms = AcceleratorSeq.filterNodesByStatus(allBPMs, true);
      final Iterator<BPM> bpmIter = bpms.iterator();
      final List<BpmAgent> bpmAgents = new ArrayList<BpmAgent>(bpms.size());
      while (bpmIter.hasNext()) {
        final BPM bpm = bpmIter.next();
        if (bpm.getValid()) {
          bpmAgents.add(new BpmAgent(bpm));
        }
      }
      Collections.sort(bpmAgents, new BPMComparator(_sequence));
      BEAM_EXCURSION_ORBIT_ADAPTOR.setBPMAgents(bpmAgents);

      AVAILABLE_BPM_AGENTS.clear();
      AVAILABLE_BPM_AGENTS.addAll(bpmAgents);
      refreshEnabledBPMs(false);
    }
  }
Exemplo n.º 4
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;
  }
Exemplo n.º 5
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();
 }
Exemplo n.º 6
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();
 }
Exemplo n.º 7
0
 /** Name of the BPM as given by its unique ID */
 public String name() {
   return bpmNode.getId();
 }