示例#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));
  }
示例#2
0
 /**
  * Get the unique corrector ID.
  *
  * @return the supply's unique ID
  */
 public String getID() {
   return _powerSupply.getId();
 }