How to plug a new Instrument

From Intrument Element Wiki

Jump to: navigation, search


Programming a new Instrument

To program a new instrument consist in the implementation of 2 or 3 interfaces, depending on the kind of control that need to be developed. What follows is a description of each one. Once you have implemented these interfaces you can enter the name of the class that you develop in the configuration file as specified in section 1.5 of this page.

Instrument Control

This class represents the abstraction of a generic instrument and it allows the remote control. Please note that an Instrument Manager (IM) can be seen as an instrument too. An Instrument Manager (IM) is the implementation of a common interface to an instrument or possible a group of real instruments or a simulation of real instruments. An IM is completely described by parameters, attributes, commands, and finite state machine:

  • Parameters hold configuration information
  • Attributes hold instrument variables
  • Command hold actions
  • Finite state machine adds constraints over the commands

IMs can be organized in a hierarchy as happens in most of the available control systems (EPICS, TANGO, PVSS, ...):



| |


You can refer to the javadoc of this interface for more information.


EXAMPLE: Voltmeter If the Instrument manager represents a virtualization of a voltmeter (it is a measuring instrument for measuring the voltage between two points in an electric circuit. more info at: . A simplified mapping of parameters, attributes, commands, and finite state machine could be:

  • Parameters: Maximum Voltage, Minimum voltage
  • Attributes: measured Voltage
  • Commands: Perform a measure
  • Finite State Machine: IM-Linked (the IM is connected the instrument), IM-Unlinked, Error.


This interface represents a generic Instrument Manager from the functionality point of view. A generic Input service, like the Error Receiver, the State Receiver, Event Listeners and the Input manager should use this interface in order to present the received information to the particular IM. You can refer to this link for more information.


Parameter Listener

This interface contains the functionality of a generic event listener. Listeners can work in pull or push way. This object can be used in order to retrieve parameters that belong to the physical instrument. You can refer to this link for more information. Image:ParameterListener.jpg

Complete Example

the class HelloWolrdIE represents a complete Object interaction. You can refer to this link for more information


Configuration Parameters

Instrument Configuration Parameters are olded by the following files:

  • : it holds configuration information about your instrument
  • : it holds additional logging information

you can find both the files in:

  • <yourWebAppName>/conf/advanced if your Instrument Element has already been deployed in a Tomcat
  • <yourProjectName>/src/main/webapp/conf/advanced if you are programming your new instrument

in the you can specify the following information:

#Specify which problem solver engine should be used

#Put true if you want that your Instrument Element will never be destroyed, any time the 
#destroy() method will be called a getIstance() will be automatically triggered.  

#Any other properties that you may want to specify will be loaded in the 
#Instrument Element Context and will be available in your classes 

remember that both BrainType and StartAsService are mandatory properties wile you can specify any other properties that you may need. You will be able to retrieve these properties in the code using the following command:

Properties prop=(Properties)IEContext.lookup(InstrumentElementConstants.ADVANCED_CONFIGURATION_PROPERTIES);

in the file you can specify information related to the log4j configuration of the logger. What follows are example of configurations:

# An example log4j configuration file that outputs to file.  The
# output information consists of relative time, log level, thread
# name, logger name, nested diagnostic context and the message in that
# order.

# For the general syntax of property based configuration files see the
# documentation of org.apache.log4j.PropertyConfigurator.
# you can find more information at:
#log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender which outputs to file. 

# A1 is set to be a SocketAppender.

# hostname and port

# A1 uses PatternLayout.

# The conversion pattern uses format specifiers. You might want to
# change the pattern an watch the output format change.
#log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x - %m%n

#Set the interesting lever for each packages
Personal tools