Class DefaultCurrentApplyModel
java.lang.Object
org.scictrl.mp.orbitcorrect.accessories.DefaultCurrentApplyModel
- All Implemented Interfaces:
IConfigurable,ICurrentApplyModel
This is default implementation of ICurrentApplyModel. It calculates AVG
value of added currents.
- Author:
- igor@scictrl.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionElementList of magnets that contribute to AVG value of current. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCurrentValue(double current, AbstractCalibratedMagnet magnet) addCurrentValue.voidconfigure(org.apache.commons.configuration.Configuration conf) configure.doublegetCurrent.intgetValueCount.voidreset()reset.
-
Field Details
-
magnets
ElementList of magnets that contribute to AVG value of current.
-
-
Constructor Details
-
DefaultCurrentApplyModel
public DefaultCurrentApplyModel()DefaultCurrentApplyModel constructor.
-
-
Method Details
-
addCurrentValue
addCurrentValue.
Adds magnet and its current to arrays.This currents are used to calculate AVG value of currents on given magnets.- Specified by:
addCurrentValuein interfaceICurrentApplyModel- Parameters:
current- a doublemagnet- aAbstractCalibratedMagnetobject
-
getCurrent
getCurrent.
getCurrent returns average value of added currents. If RMS of currents differes from AVS more than DataBush precision, InconsistentDataException exception is thrown. Fields magnets and values are cleard.- Specified by:
getCurrentin interfaceICurrentApplyModel- Returns:
- a double
- Throws:
InconsistentDataException- if any.IllegalStateException- if any.
-
getValueCount
public int getValueCount()getValueCount.
Returnes the number of currents that contribute to AVG.- Specified by:
getValueCountin interfaceICurrentApplyModel- Returns:
- a int
-
reset
public void reset()reset.
Cleares magnets and values.After reseting one could calculate new AVG.- Specified by:
resetin interfaceICurrentApplyModel
-
configure
public void configure(org.apache.commons.configuration.Configuration conf) configure.
- Specified by:
configurein interfaceIConfigurable- Parameters:
conf- aConfigurationobject
-