# Presentation: 373041

## CDF Run Control Implementation

- Elliott McCrory
- BD/Proton Source/Linac & CDF
- September 18, 2001

## Talk Overview

- Overview
- Major OO Components
- Some class diagrams
- Key Elements:
- Classes
- Interfaces
- Listeners
- Transition & TransitionStateMachine
- Scripting
- Performance

- Elliott McCrory

- 18 September 2001

## Overview of Run Control

- RC and most of its components are implemented in Java
- OO??
- Platform: FRH Linux
- Began with SGI Irix
- Swing-based GUI
- JDBC
- SmartSockets communications
- Heavily threaded

- Elliott McCrory

- 18 September 2001

## State Manager

- SmartSockets Server(s)

- Consumer

*Error Handler*

*Error Handler*

*Error Handler*

- RunSet (Configuration) Database

- OnlineData

- VME n

- VME n+1

- VME n+2

- Level 2

- Level 3

- VME n+3

- Consumer

- Elliott McCrory

- 18 September 2001

## Major Components of RC

- RunSet editor for client configuration
- Error handler for expert system control
- Data consumers
- VxWorks coordination
- General state machine logic
- Discussed here
- Scripting interface for calibrations

- Elliott McCrory

- 18 September 2001

## GUI

- Active State

- Available Transition

- Status of RC

- Tevatron Status

- Unavailable Transition

- Elliott McCrory

- 18 September 2001

## Top-Level Class View

- GUI.class

- rcBase.class

- Shell.class

*Jpython Scripting Classes*

- daqStateManager.class

- GenericCalibStateManager.class

- QIECalibStateManager.class

- RunSet.class

- RunSetEditor.class

- PartitionSelector.class

- RunTypeSelector.class

- ConsumerEditor.class

- VxConfig.class

- ErrorHandler.class

- Elliott McCrory

- 18 September 2001

## RC State Machine/Manager

- FSM.class

- Transition.class

- daqStateManager.class

- GenericCalibStateManager.class

- TransitionStateMachine.class

- State.class

- QIECalibStateManager.class

- messenger.class

- readoutConfig.class

- ConfigMess.class

- StateManager.class

- Elliott McCrory

- 18 September 2001

## Key Concepts

- Modularism, abstraction, inheritance/polymorphism, data hiding, Mom & apple pie
- Some “Design Patterns”
- Isolation of GUI from FSM
- Control flows “down”; GUI information flows “up” through listeners and interfaces

- Elliott McCrory

- 18 September 2001

## Key Classes

- FSM
- Generalized finite state machine
- StateManager
- CDF RC specific
- State
- Transition
- TransitionStateMachine
- DebugLevel
- Handles diagnostic printout

- messenger
*Singelton *Design Pattern
- Handles messaging to clients
- ConfigMess
- Abstract: all clients use this class for their configuration messages
- ConfigMessageFactory
*Factory *Design Pattern
- Returns a ConfigMess
- readoutConfig
- Handles reception of replies from clients

- Elliott McCrory

- 18 September 2001

## Key Interfaces

- RCAction
*Command *Design Pattern
- Perform an action when entering a state
- public boolean execute()
- RCCondition
- public boolean isMet() to leave a state
- public boolean isViolated() when an error is encountered
- public void reset()

- Elliott McCrory

- 18 September 2001

## Key Listeners

- GUI Enabling
- StateChangeListener
- TransitionChangeListener
- FsmStatusListener
- Global information management
- StateEventListener

- Elliott McCrory

- 18 September 2001

## Implementation of Transitions

- Specifications say: Sequence RCAction’s
- e.g., you must configure all clients (“ColdStart”) before configuring Level 3
- Implemented as a FSM
- TransitionStateMachine extends Transition and “Has A” FSM

- Elliott McCrory

- 18 September 2001

## Transition Sub State Machine

- S*x* = sub state
- ES*x* = Error State
- A*x *= Action upon entering State
- C*x* = Condition for leaving State

- Elliott McCrory

- 18 September 2001

## Scripting

- Used for calibrations
- Desire to change one or two parameters in a client crate’s configuration message over ~10 calibration iterations
- Initially implemented in Jpython
- Basic JPython class extends Java class Shell
- Generally requires “isinstance()” JPython operator to find configuration message for crate being calibrated
- Being abandoned for all-Java solution
- Benefits of scripting (easy changes) not strong enough to outweigh drawbacks (new language).

- Elliott McCrory

- 18 September 2001

## Performance

- Startup of rc.GUI: about 1 minute
- Java VM: 10’s of MB
- Run-time performance: no issue
- Knowledgeable and/or relevant programmers: 3 to 10

- Elliott McCrory

- 18 September 2001

## Summary

- Java implementation of CDF Run Control
- Swing GUI
- Some OO techniques
- Calibration scripts in JPython, moving to Java calibration programs

- Elliott McCrory

- 18 September 2001