Package xal.app.virtualaccelerator
Class NoiseGenerator
- java.lang.Object
-
- xal.app.virtualaccelerator.NoiseGenerator
-
public class NoiseGenerator extends Object
NoiseGenerator generates noise for readback PVs- Version:
- 0.1 02 Mar 2004
- Author:
- Paul Chu
-
-
Constructor Summary
Constructors Constructor Description NoiseGenerator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublegetAverage(double[] array, int dataLength)Get the average from the arraystatic double[]noisyArrayForNominal(double nominalValue, int arrayLength, int dataLength, double noiseLevel, double offset)Get an array with noise based on a nominal value.static doublesetValForPV(double pvVal, double noiseLevel, double offset, boolean relative)input the "set" PV and return double value as the corresponding readback PV value
-
-
-
Method Detail
-
setValForPV
public static double setValForPV(double pvVal, double noiseLevel, double offset, boolean relative)input the "set" PV and return double value as the corresponding readback PV value- Parameters:
pvVal- the "set" PV valuenoiseLevel- noise level for the readback PVoffset- offset from the nominal valuerelative- if noise should be set relative to pvVal- Returns:
- readback PV value with noise added
-
noisyArrayForNominal
public static double[] noisyArrayForNominal(double nominalValue, int arrayLength, int dataLength, double noiseLevel, double offset)Get an array with noise based on a nominal value. This function is used by instrumentation, so we assume that noise is given in respective units and not in percentage.- Parameters:
arrayLength- total length of the arraydataLength- length of the array to populate with data starting with index 0nominalValue- nominal value for entire arraynoiseLevel- level of the noise to applyoffset- offset from the nominal value
-
getAverage
public static double getAverage(double[] array, int dataLength)Get the average from the array
-
-