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
FieldsModifier and TypeFieldDescriptionstatic final StringConstantCURRENT="current"protected booleanData invalidated flag.doubleDefault max value.doubleDefault min value.static final intConstantPR_CURRENT=2Fields inherited from class org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement
lastActionResult, owner, PR_ELEMENT_NAME, PR_VIRTUAL -
Constructor Summary
ConstructorsConstructorDescriptionPowerSupply(String name) Constructs aPowerSupplywith specified name and default parameters vauesPowerSupply(String name, boolean virtual, double current) Constructs aPowerSupplywith specified parameters -
Method Summary
Modifier and TypeMethodDescriptionintThis method sets current, thatPowerSupplycurrently holds, toPowerSupplyBean.intconnect()Binds to remote object.Returns the descriptor object for this element.intDestroys connection.intelType()Returns the code of element's type.This method returns fieldpsBean.doubleGetter for the fieldcurrent.This method returnMagnetListwith magnets, that are powered with power supply which is represented byPowerSupplydoubleThis method return maximum current, that can power supply safely exceed.doubleThis method return minimum current, that can power supply exceed.voidSetsDataInvalidatedflag totrue.booleanReturnstrueif element is binded,falseotherwise.booleanReturnstrueif element's data is not synchronized with associated element or Abean.booleanThis method tests if power supply is useable.voidnotifyDataUpdate(Double data) Called by data connection when new value update arrivesvoidsetCurrent(double value) This method sets current.voidSets parameters values of this element to those in parameter array.booleantest()This method tests if power supply.toString()Returns the string representation of this element.intupdate()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, throwISEMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
notifyDataUpdatein interfaceIBindedElement<Double>- Parameters:
data- new data, if value is OK,nullif last arrive value signals problems and can not be thrusted
-
applyCurrent
This method sets current, thatPowerSupplycurrently 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:
connectin 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.DBElementDescriptorhelps manipulating DataBush elements dynamically. Returns the descriptor object for this element.DBElementDescriptorhelps manipulating DataBush elements dynamically.- Specified by:
descriptorin 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:
disconnectin 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:
elTypein 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. IfPowerSupplyis connected, this field is property of control systemPowerSupplyBeanand change of it explicitly affect current.- Returns:
- a
IWriteConnectorobject
-
getDependingMagnets
This method returnMagnetListwith 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()SetsDataInvalidatedflag 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:
invalidateDatain interfaceAbstractUpdateableElement- Specified by:
invalidateDatain interfaceIApplyableElement- See Also:
-
isConnected
public boolean isConnected()Returnstrueif element is binded,falseotherwise. This method tests ifPowerSupplyis connected.- Specified by:
isConnectedin interfaceIBindedElement<Double>- Returns:
trueif element is binded,falseotherwise.- See Also:
-
isDataInvalidated
public boolean isDataInvalidated()Returnstrueif 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:
isDataInvalidatedin interfaceAbstractUpdateableElement- Specified by:
isDataInvalidatedin interfaceIApplyableElement- Returns:
trueif 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:
Trueif is.
-
test
public boolean test()This method tests if power supply.- Returns:
Trueif 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 notnullobject in array.setWith.
- Overrides:
setWithin classAbstractDataBushElement- Parameters:
par- an array ofObjectobjects- 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:
toStringin interfaceISimpleElement- Overrides:
toStringin 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 fromPowerSupplyBeanand save it to field current- Specified by:
updatein interfaceAbstractUpdateableElement- Returns:
- a int the return code indicating success
- Throws:
IllegalStateException- thrown if status of DataBush equalsDB_EMPTYDataBushPackedException- contains all exception thrown or caught during updating element
-