Example #1
0
  /**
   * Wrap the corrector's channel corresponding to the specified handle.
   *
   * @param handle Description of the Parameter
   * @return Description of the Return Value
   */
  protected ChannelWrapper wrapChannel(final String handle) {
    Channel channel = _powerSupply.getChannel(handle);
    ChannelWrapper wrapper = new ChannelWrapper(channel);

    wrapper.addChannelEventListener(
        new ChannelEventListener() {
          /**
           * The PV's monitored value has changed.
           *
           * @param channel the channel whose value has changed
           * @param record The channel time record of the new value
           */
          public void valueChanged(Channel channel, ChannelTimeRecord record) {
            _latestField = record.doubleValue();
            EVENT_PROXY.fieldChanged(CorrectorSupply.this, record, _latestField);
          }

          /**
           * The channel's connection has changed. Either it has established a new connection or the
           * existing connection has dropped.
           *
           * @param channel The channel whose connection has changed.
           * @param connected The channel's new connection state
           */
          public void connectionChanged(Channel channel, boolean connected) {
            _latestField = Double.NaN;
            EVENT_PROXY.connectionChanged(CorrectorSupply.this, connected);
          }
        });

    wrapper.requestConnection();

    return wrapper;
  }
Example #2
0
 /**
  * Set the field to the value specified.
  *
  * @param field the field in Tesla
  */
 public void setField(final double field) {
   try {
     _powerSupply.setField(field);
   } catch (Exception exception) {
     throw new RuntimeException("Field setting exception.", exception);
   }
 }
Example #3
0
  /** Constructor */
  public CorrectorSupply(final MagnetMainSupply powerSupply) {
    PUT_HANDLER = new PutHandler();

    _powerSupply = powerSupply;

    _correctors = new ArrayList<CorrectorAgent>();
    _latestField = Double.NaN;
    _lowerFieldLimit = Double.NaN;
    _upperFieldLimit = Double.NaN;

    MESSAGE_CENTER = new MessageCenter();
    EVENT_PROXY = MESSAGE_CENTER.registerSource(this, CorrectorSupplyListener.class);

    wrapChannels();
    LIMITS_HANDLER = new LimitsHandler(powerSupply.getChannel(MagnetMainSupply.FIELD_SET_HANDLE));
  }
Example #4
0
 /**
  * Read the field set point.
  *
  * @return the current field set point
  */
 public double getFieldSetting() throws xal.ca.ConnectionException, xal.ca.GetException {
   return _powerSupply.getFieldSetting();
 }
Example #5
0
 /**
  * Get the unique corrector ID.
  *
  * @return the supply's unique ID
  */
 public String getID() {
   return _powerSupply.getId();
 }