Exemple #1
0
  /**
   * Load the correctors of the specified type, construct the corresponding corrector agents and
   * populate the corrector agent list.
   *
   * @param correctorAgents the list to which the corrector agents should be added
   * @param nodeType the type of corrector nodes to fetch
   */
  public void loadCorrectors(final List<CorrectorAgent> correctorAgents, final String nodeType) {
    final Map<String, CorrectorSupply> supplyMap = new HashMap<String, CorrectorSupply>();
    final List<Dipole> allCorrectors = _sequence.getAllNodesOfType(nodeType);
    final List<Dipole> correctors = AcceleratorSeq.filterNodesByStatus(allCorrectors, true);

    final Iterator<Dipole> correctorIter = correctors.iterator();
    while (correctorIter.hasNext()) {
      final Dipole corrector = correctorIter.next();
      final MagnetMainSupply supply = corrector.getMainSupply();
      if (supply != null) {
        final String supplyID = supply.getId();
        if (!supplyMap.containsKey(supplyID)) {
          supplyMap.put(supplyID, new CorrectorSupply(supply));
        }
        final CorrectorSupply supplyAgent = supplyMap.get(supplyID);
        final CorrectorAgent correctorAgent = new CorrectorAgent(corrector);
        supplyAgent.addCorrector(correctorAgent);
        _correctorAgents.add(correctorAgent);
      }
    }

    _correctorSupplyMap = supplyMap;
    _correctorSupplies = new ArrayList<CorrectorSupply>(supplyMap.values());
    Collections.sort(
        _correctorSupplies, CorrectorSupply.getFirstCorrectorPositionComparator(_sequence));
  }
Exemple #2
0
 /** Use setpoints for electromagnets. */
 public void useSetpoints(final AcceleratorSeq sequence) {
   if (sequence != null) {
     final List<AcceleratorNode> magnets = sequence.getNodesOfType(Electromagnet.s_strType, true);
     for (AcceleratorNode node : magnets) {
       ((Electromagnet) node).setUseFieldReadback(false);
     }
   }
 }
 /**
  * Sets the accelerator sequence
  *
  * @param accSeq The new accelSeq value
  */
 public void setAccelSeq(AcceleratorSeq accSeq) {
   java.util.List<AcceleratorNode> accNodes = accSeq.getNodesOfType(Electromagnet.s_strType);
   java.util.Iterator<AcceleratorNode> itr = accNodes.iterator();
   while (itr.hasNext()) {
     Electromagnet emg = (Electromagnet) itr.next();
     if (emg.getStatus()) {
       emg.setUseFieldReadback(false);
     }
   }
   ringFoilPosCorr.setAccelSeq(accSeq);
 }
Exemple #4
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);
    }
  }
Exemple #5
0
 /**
  * Get the position of the first corrector relative to the start of the specified sequence.
  *
  * @param sequence The sequence relative to which the corrector's position is measured
  * @return the position of this supply's first corrector relative to the sequence in meters
  */
 public double getFirstCorrectorPositionIn(AcceleratorSeq sequence) {
   return sequence.getPosition(_correctors.get(0).getCorrector());
 }
Exemple #6
0
 /** Get the position of the BPM */
 public double getPosition() {
   return sequence.getPosition(bpmNode);
 }