Class PowerSupply
java.lang.Object
org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement
org.scictrl.mp.orbitcorrect.model.optics.PowerSupply
- All Implemented Interfaces:
Cloneable
,ISimpleElement
,AbstractUpdateableElement
,IApplyableElement
,IBindedElement<Double>
public class PowerSupply
extends AbstractDataBushElement
implements IBindedElement<Double>, AbstractUpdateableElement, IApplyableElement
This class represents power supply. It connects to
PowerSupplyBean
and can read
current from it and set it. Can also distribute current to dependant magnets or read from it.- Author:
- igor@scictrl.com
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
ConstantCURRENT="current"
protected boolean
Data invalidated flag.double
Default max value.double
Default min value.static final int
ConstantPR_CURRENT=2
Fields inherited from class org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement
lastActionResult, owner, PR_ELEMENT_NAME, PR_VIRTUAL
-
Constructor Summary
ConstructorDescriptionPowerSupply
(String name) Constructs aPowerSupply
with specified name and default parameters vauesPowerSupply
(String name, boolean virtual, double current) Constructs aPowerSupply
with specified parameters -
Method Summary
Modifier and TypeMethodDescriptionint
This method sets current, thatPowerSupply
currently holds, toPowerSupplyBean
.int
connect()
Binds to remote object.Returns the descriptor object for this element.int
Destroys connection.int
elType()
Returns the code of element's type.This method returns fieldpsBean
.double
Getter for the fieldcurrent
.This method returnMagnetList
with magnets, that are powered with power supply which is represented byPowerSupply
double
This method return maximum current, that can power supply safely exceed.double
This method return minimum current, that can power supply exceed.void
SetsDataInvalidated
flag totrue
.boolean
Returnstrue
if element is binded,false
otherwise.boolean
Returnstrue
if element's data is not synchronized with associated element or Abean.boolean
This method tests if power supply is useable.void
notifyDataUpdate
(Double data) Called by data connection when new value update arrivesvoid
setCurrent
(double value) This method sets current.void
Sets parameters values of this element to those in parameter array.boolean
test()
This method tests if power supply.toString()
Returns the string representation of this element.int
update()
Reads value from associated element or Abean and calculates it's new values.Methods inherited from class org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement
clone, equals, getLastActionResult, getName, getOwner, getVirtual, hashCode, isInitialized, isVirtual, setVirtual, throwISE
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.scictrl.mp.orbitcorrect.ISimpleElement
clone, getName
-
Field Details
-
PR_CURRENT
public static final int PR_CURRENTConstantPR_CURRENT=2
- See Also:
-
CURRENT
ConstantCURRENT="current"
- See Also:
-
defaultMaxValue
public double defaultMaxValueDefault max value. -
defaultMinValue
public double defaultMinValueDefault min value. -
dataInvalidated
protected boolean dataInvalidatedData invalidated flag.
-
-
Constructor Details
-
Method Details
-
notifyDataUpdate
Called by data connection when new value update arrives- Specified by:
notifyDataUpdate
in interfaceIBindedElement<Double>
- Parameters:
data
- new data, if value is OK,null
if last arrive value signals problems and can not be thrusted
-
applyCurrent
This method sets current, thatPowerSupply
currently holds, toPowerSupplyBean
.- Returns:
- a int
- Throws:
IllegalStateException
- if any.DataBushPackedException
- if any.
-
connect
Binds to remote object. Returns the code indication success of bind. Connects element to InfoServerBean device. Returns the success code of operation.- Specified by:
connect
in interfaceIBindedElement<Double>
- Returns:
- the code indication success of bind.
- Throws:
DataBushPackedException
- if bind exception occurs.IllegalStateException
- See Also:
-
descriptor
Returns the descriptor object for this element.DBElementDescriptor
helps manipulating DataBush elements dynamically. Returns the descriptor object for this element.DBElementDescriptor
helps manipulating DataBush elements dynamically.- Specified by:
descriptor
in classAbstractDataBushElement
- Returns:
- the descriptor object for this element.
- See Also:
-
disconnect
Destroys connection. Returns the code indication success of destroy. Disconnects element from InfoServerBean device. Returns the success code of operation.- Specified by:
disconnect
in interfaceIBindedElement<Double>
- Returns:
- the code indication success of destroy.
- Throws:
IllegalStateException
- See Also:
-
elType
public int elType()Returns the code of element's type. Returns the code of element's type.- Specified by:
elType
in classAbstractDataBushElement
- Returns:
- the code of element's type.
- See Also:
-
getCurrent
public double getCurrent()Getter for the field
current
.- Returns:
- a double
-
getConnector
This method returns fieldpsBean
. IfPowerSupply
is connected, this field is property of control systemPowerSupplyBean
and change of it explicitly affect current.- Returns:
- a
IWriteConnector
object
-
getDependingMagnets
This method returnMagnetList
with magnets, that are powered with power supply which is represented byPowerSupply
- Returns:
- MagnetList
-
getMaxCurrent
This method return maximum current, that can power supply safely exceed.- Returns:
- a double
- Throws:
IllegalStateException
- if any.ControlSystemException
- if any.
-
getMinCurrent
This method return minimum current, that can power supply exceed.- Returns:
- a double
- Throws:
IllegalStateException
- if any.ControlSystemException
- if any.
-
invalidateData
public void invalidateData()SetsDataInvalidated
flag totrue
. This method invalidate data which means that at least one data in this object is not consistent with other object's data. It is necessary to update this object or apply (if possible).- Specified by:
invalidateData
in interfaceAbstractUpdateableElement
- Specified by:
invalidateData
in interfaceIApplyableElement
- See Also:
-
isConnected
public boolean isConnected()Returnstrue
if element is binded,false
otherwise. This method tests ifPowerSupply
is connected.- Specified by:
isConnected
in interfaceIBindedElement<Double>
- Returns:
true
if element is binded,false
otherwise.- See Also:
-
isDataInvalidated
public boolean isDataInvalidated()Returnstrue
if element's data is not synchronized with associated element or Abean. This fag goes to false after update or apply. This method tests if data is invalidated.- Specified by:
isDataInvalidated
in interfaceAbstractUpdateableElement
- Specified by:
isDataInvalidated
in interfaceIApplyableElement
- Returns:
true
if element's data is not synchronized with associated element or Abean.- See Also:
-
isUseable
public boolean isUseable()This method tests if power supply is useable.- Returns:
True
if is.
-
test
public boolean test()This method tests if power supply.- Returns:
True
if is.
-
setCurrent
public void setCurrent(double value) This method sets current.- Parameters:
value
- a double
-
setWith
Sets parameters values of this element to those in parameter array. As parameter must be used such array as for dynamical construction of new instance of this class. Current values are overriden for each notnull
object in array.setWith.
- Overrides:
setWith
in classAbstractDataBushElement
- Parameters:
par
- an array ofObject
objects- Throws:
IllegalStateException
- if element is initialized and inside DataBush.- See Also:
-
toString
Returns the string representation of this element. Returns string describing this element. String is formated in input-file code. Returns a String that represents the value of this object.- Specified by:
toString
in interfaceISimpleElement
- Overrides:
toString
in classAbstractDataBushElement
-
update
Reads value from associated element or Abean and calculates it's new values. Metod reads data from other databush elements or from remote devices represented with Abean. Metod also checksisDataInvalidated()
on depending databush elements, if value has changed. Return value is identification code of error. Note! Update is performed only if virtual flag is set tofalse
. Note! All update methods are synchronized, so only one update is called at time. For update od group of elements call update on appropriate element-list or DataBush. This method read current fromPowerSupplyBean
and save it to field current- Specified by:
update
in interfaceAbstractUpdateableElement
- Returns:
- a int the return code indicating success
- Throws:
IllegalStateException
- thrown if status of DataBush equalsDB_EMPTY
DataBushPackedException
- contains all exception thrown or caught during updating element
-