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
Modifier and TypeFieldDescriptionElementList of magnets that contribute to AVG value of current. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCurrentValue
(double current, AbstractCalibratedMagnet magnet) addCurrentValue.void
configure
(org.apache.commons.configuration.Configuration conf) configure.double
getCurrent.int
getValueCount.void
reset()
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:
addCurrentValue
in interfaceICurrentApplyModel
- Parameters:
current
- a doublemagnet
- aAbstractCalibratedMagnet
object
-
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:
getCurrent
in 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:
getValueCount
in interfaceICurrentApplyModel
- Returns:
- a int
-
reset
public void reset()reset.
Cleares magnets and values.After reseting one could calculate new AVG.- Specified by:
reset
in interfaceICurrentApplyModel
-
configure
public void configure(org.apache.commons.configuration.Configuration conf) configure.
- Specified by:
configure
in interfaceIConfigurable
- Parameters:
conf
- aConfiguration
object
-