Exemplo n.º 1
0
 /**
  * Scale the field by beta-gamma to preserve the magnet's influence on the beam.
  *
  * @param kineticEnergy
  * @param designKineticEnergy
  * @param restEnergy
  */
 public void preserveDesignInfluence(
     final double kineticEnergy, final double designKineticEnergy, final double restEnergy) {
   final double energy = kineticEnergy + restEnergy;
   final double designEnergy = designKineticEnergy + restEnergy;
   final double betaGamma = Math.sqrt(Math.pow(energy / restEnergy, 2) - 1.0);
   final double designBetaGamma = Math.sqrt(Math.pow(designEnergy / restEnergy, 2) - 1.0);
   final LiveParameter fieldParameter = getLiveParameter(FIELD_INDEX);
   final double designField = fieldParameter.getDesignValue();
   fieldParameter.setCustomValue(designField * betaGamma / designBetaGamma);
 }
Exemplo n.º 2
0
    /** handle the get value callback */
    public void eventValue(final ChannelRecord record, final Channel channel) {
      synchronized (this) {
        if (channel == _lowerChannel) {
          _rawLowerFieldLimit = record.doubleValue();
        } else if (channel == _upperChannel) {
          _rawUpperFieldLimit = record.doubleValue();
        }

        if (hasLimits()) {
          _fieldLimits[0] = Math.min(_rawLowerFieldLimit, _rawUpperFieldLimit);
          _fieldLimits[1] = Math.max(_rawLowerFieldLimit, _rawUpperFieldLimit);
          EVENT_PROXY.fieldLimitsChanged(CorrectorSupply.this, _fieldLimits[0], _fieldLimits[1]);
        }
      }
    }
Exemplo n.º 3
0
  /** Set the custom field limits as a fraction of the operational limits */
  public void setOperationalFieldLimitsFraction(final double fraction) {
    final double operationalLowerLimit = getHardLowerFieldLimit();
    final double operationalUpperLimit = getHardUpperFieldLimit();

    // verify that both operational limits are valid
    if (!Double.isNaN(operationalLowerLimit) && !Double.isNaN(operationalUpperLimit)) {
      if (fraction == 1.0) { // if 100% indicate that the limits are no longer custom
        _lowerFieldLimit = Double.NaN;
        _upperFieldLimit = Double.NaN;
      } else {
        final double halfRange =
            fraction * Math.abs(operationalUpperLimit - operationalLowerLimit) / 2;
        final double operationalMean = (operationalUpperLimit + operationalLowerLimit) / 2;
        final double lowerLimit = operationalMean - halfRange;
        final double upperLimit = operationalMean + halfRange;

        setLowerFieldLimit(lowerLimit);
        setUpperFieldLimit(upperLimit);
      }
    }
  }