CCS code short description

Principles

Subsystems

The CCS is a set of Camera subsystems and 3 communication buses:

  • command bus
  • status bus
  • log bus

Each Subsystem will register itself on the three buses (command, status, log). It broad-casts its status, and can receive commands.

Each subsystem is a set of modules. Example: FCS, Filter Changer System is a subsystem. The engine which moves the carousel is a module of the subsystem FCS.

Buses

  • Command bus (or Bus Master)

The CCS send commands to subsystems and the sub-systems send their responses over this bus. A bus master is a subsystem that can send write commands and acquire locks.

  • Status bus

Status and reporting information are sent by subsystems to the CCS on this bus.

  • Log bus

This third bus is used for logging purpose.

Modules

A subsystem, in fact a modular subsystem, is a set of modules which listen to each other. Each module communicates with the other modules over a local bus.

Example: FCS, the Filter Changer System contains many modules:

  • an engine to move the carousel
  • latches
  • sensors

The CCS code is built over a home-made framework. The framework is used to describe the components (modules) of the subsystem, and their interactions, in a XML file. For example, if in a subsystem, there are two latches (each latch is a module): latch A and latch B. Latch B cannot be open if latch A is open. This can be described in a XML file.

Implementation

The tools we use in the code

  • JAVA
  • AspectJ
  • Spring
  • JBOSS‚ AOP, JMS server

Main Java Classes and Interfaces

The name of the CCS package is: org.lsst.ccs. Forget about org.lsst.control.

In the org.lsst.ccs package, you can find two classes: BusMaster and Subsystem, and sub-packages.

The best way to become familiar with the current code is to browse the javadoc documentation (see section 3). This section is a plagiarism (perhaps a bad one!) of the javadoc documentation.

Subsystem Class

The Subsystem class is the base class for a CCS subsystem. This object will register itself on the three buses (control, status, log). It broad-casts its status, and can receive commands. A lot of classes extend the Subsystem class: ModularSubsystem for example.

BusMaster Class

A bus master is a subsystem that can send commands and acquire locks. For example, in the test system, the TestConsole on which we type commands to the TempDummy subsystem is a BusMaster.

org.lsst.ccs.bus package

Contains classes concerning commands, alarm and status. org.lsst.bus has two sub-packages: bus.jms and bus.lock.

The org.lsst.ccs.bus.jms package is the interface with JMS. This package can be replaced if we want to use an other messaging system.

org.lsst.ccs.localbus

Contains the classes useful to describe each subsystem:

  • ModularSubsystem is the main class in this package: it extends the Subsystem class. The ModularSubsystem class provides methods to build a subsystem by assembling modules. A ModularSubsystem is initiated from a XML file.
  • Module class extends java.util.Observable. Each module starts a timer.

This package also contains two sub-packages: org.lsst.ccs.localbus.test where you can find the code to run the test (DummyTemp test); and org.lsst.ccs.localbus.common that contains common utilities, for example the Averager class.

org.lsst.ccs.device

Contains the class DMMIOBoard which was used to run the test code in the January 2008 CCS meeting.

org.lsst.ccs.driver

Contains the tools used to communicate with the PC104 during the test code in the January 2008 CCS meeting.

org.lsst.ccs.state

This package has only one class, State, which is an enum class to enumerate the different states of a subsystem: active, in error, offline, ready, recovering.

org.lsst.ccs.fcs

Package for the Filter Changer System, FCS. Each subsystem will likewise have its own package.

What do we do with Spring and in which part of the code ?

Spring is used only to initiate the Modular Subsystem from a XML file (method init- FromXML in the org.lsst.ccs.localbus.ModularSubsystem? class).

The initial XML file is written in a special CCS XML (rather simple and intuitive). So this CCS-XML file is translated into a Spring-XML stream. Then this Spring-XML stream is read to initiate the Modular Subsystem with its list of modules and interactions between modules. To do the CCS-XML to Spring-XML translation, we use an xsl file:

org/lsst/ccs/localbus/xsl/desc2spring.xsl

.

What do we do with AspectJ and in which part of the code ?

In the current code, AspectJ is used only to test the principle. AspectJ is used only in the org.lsst.ccs.localbus.test to define the constraints: in our test, latch B cannot be open if latch A is open. See the ConstraintAspect class.

What do we do with Java Messaging Service

JMS is used to manage the communications on the 3 bus : control, command and status. It can be easily replace with an other messaging system if needed. At that time (january 2010), we use a little jboss jmsserver only. It is installed on the svn server in a directory named jmsserver. (see below)

How to install and use the code

You can use the current code to simulate a Dummy Temperature subsystem with 5 Modular subsystems:

  • a dummy temperature sensor which gives its temperature every 100ms (dummyTemp)
  • a modular subsystem which computes the average of the preceding values during 2 seconds (dummyTempAverager)
  • a temperature publisher which listens to the average computer and publishes the values given by the average computer (tempPublisher)
  • two latches (latch A and latch B) which are bound by constraints: latch B cannot be open if latch A is open.

The above description is writen in a XML file. To play with it you have to install the CCS code and a jmsserver, as explained below.

Install the CCS java code

  1. Download the code from the svn server in a directory named, for instance, LSSTDIR.
  1. Compile it with the commands:

cd LSSTDIR/trunk/CameraControl

      > ant jar
      > ant doc

Browse the Java doc

The last command generates the HTML javadoc documentation in a directory named doc: LSSTDIR/trunk/CameraControl/doc. You can use your favorite browser to browse this documentation.

Configure the java naming directory interface (JNDI) so java

knows where our jmsserver is

cd LSSTDIR/trunk/CameraControl/
cp jndi-jboss.properties jndi.properties

Run the current CCS code

You have to open 4 windows.

  1. window 1: run the jmsserver

    cd jmsserver/jboss/bin
      ./run.sh
  1. window 2: run the tracer

cd LSSTDIR/trunk/CameraControl/
      ./run-module org.lsst.ccs.test.Tracer 1
  1. window 3: run the Dummy Temperature subsystem

cd LSSTDIR/trunk/CameraControl/
      ./run-module org.lsst.ccs.localbus.ModularSubsystem conf/test-ccs.xml

The file test-ccs.xml contains the description of our Dummy Temperature subsys- tem.

  1. window 4: run a Test Console to send commands to the Dummy Temperature sub- system

    cd LSSTDIR/trunk/CameraControl/
      ./run-module org.lsst.ccs.test.TestConsole

TestConsole is a BusMaster. You are now ready to send commands to the Dummy Temperature subsystem. Type in the TestConsole:

      >   config   ccs-test dummyTemp/tickMillis -1
      >   config   ccs-test/latch-A motionTimeMillis 10000
      >   invoke   ccs-test/latch-A open
      >   invoke   ccs-test/latch-B open

and read what happens in the different windows.