Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  1. #Setup
    1. #Environment
    2. #Dependencies
    3. #Test inside Eclipse
  2. #Development
    1. #Overview
    2. #Launch Script
    3. #Classes and Functions
      1. #Message
      2. #Other
  3. #Release with Eclipse
    1. #Starting and Stopping
  4. #Troubleshooting#Troubleshoot

Setup

Environment

  • Effectively, you can only develop MPS History Server inside Eclipse on lcls-builder.
  • Check out the CVS module physics/mps/mpshist into your workspace
    • From now on, the root of project is referred to as $MPSHIST_ROOT

...

Code Block
///****************************************************************************
// * Data Pointers
// ****************************************************************************/
///* Note: The history message header begins at the first byte of TCP Data
// */
// 
//#define HISTORY_MESSAGE_HEADER_SECTION_POINTER(_pointerToFullMessage)      ((epicsInt8  *)(_pointerToFullMessage)   + 0)
//#define HISTORY_MESSAGE_PROTOCOL_VERSION_POINTER(_pointerToHistoryHeader)  ((epicsUInt8 *)(_pointerToHistoryHeader) + 0)
//#define HISTORY_MESSAGE_TYPE_POINTER(_pointerToHistoryHeader)              ((epicsUInt8 *)(_pointerToHistoryHeader) + 1)
//#define HISTORY_MESSAGE_DATA_SECTION_POINTER(_pointerToHistoryHeader)      ((epicsInt8  *)(_pointerToHistoryHeader) + 2)
//
//#define HISTORY_MESSAGE_PROTOCOL_VERSION(_pointerToHistoryHeader)          (*HISTORY_MESSAGE_PROTOCOL_VERSION_POINTER(_pointerToHistoryHeader))
//#define HISTORY_MESSAGE_TYPE(_pointerToHistoryHeader)                      (*HISTORY_MESSAGE_TYPE_POINTER(_pointerToHistoryHeader))
//
///****************************************************************************
// * Super Message
// ****************************************************************************/
///* All history message struct data.
// */
//
//
//
//#define HISTORY_SUPER_MESSAGE_SIZE                                           (16 + MPSHistoryProtocolHeaderSize)
//
//#define HISTORY_SUPER_TIMESTAMP_SECPASTEPOCH_POINTER(_pointerToHistoryData)  ((epicsUInt32 *)((_pointerToHistoryData) +  0))
//#define HISTORY_SUPER_TIMESTAMP_NSEC_PULSEID_POINTER(_pointerToHistoryData)  ((epicsUInt32 *)((_pointerToHistoryData) +  4))
//#define HISTORY_SUPER_TIMESLOT_POINTER(_pointerToHistoryData)                ((epicsUInt8  *)((_pointerToHistoryData) +  8))
//#define HISTORY_SUPER_TYPE_POINTER(_pointerToHistoryData)                    ((epicsUInt8  *)((_pointerToHistoryData) +  9))
//#define HISTORY_SUPER_ID_POINTER(_pointerToHistoryData)                      ((epicsUInt32 *)((_pointerToHistoryData) + 10))
//#define HISTORY_SUPER_OLD_VALUE_POINTER(_pointerToHistoryData)               ((epicsUInt32 *)((_pointerToHistoryData) + 14))
//#define HISTORY_SUPER_NEW_VALUE_POINTER(_pointerToHistoryData)               ((epicsUInt32 *)((_pointerToHistoryData) + 18))
//
//#define HISTORY_SUPER_TIMESTAMP_SECPASTEPOCH(_pointerToHistoryData)          (*HISTORY_SUPER_TIMESTAMP_SECPASTEPOCH_POINTER(_pointerToHistoryData))
//#define HISTORY_SUPER_TIMESTAMP_NSEC_PULSEID(_pointerToHistoryData)          (*HISTORY_SUPER_TIMESTAMP_NSEC_PULSEID_POINTER(_pointerToHistoryData))
//#define HISTORY_SUPER_TIMESLOT(_pointerToHistoryData)                        (*HISTORY_SUPER_TIMESLOT_POINTER(_pointerToHistoryData))
//#define HISTORY_SUPER_TYPE(_pointerToHistoryData)                            (*HISTORY_SUPER_TYPE_POINTER(_pointerToHistoryData))
//#define HISTORY_SUPER_ID(_pointerToHistoryData)                              (*HISTORY_SUPER_ID_POINTER(_pointerToHistoryData))
//#define HISTORY_SUPER_OLD_VALUE(_pointerToHistoryData)                       (*HISTORY_SUPER_OLD_VALUE_POINTER(_pointerToHistoryData))
//#define HISTORY_SUPER_NEW_VALUE(_pointerToHistoryData)                       (*HISTORY_SUPER_NEW_VALUE_POINTER(_pointerToHistoryData))

edu.stanford.slac.mpshist.message.MessageRepository
  • A singleton that caches MPS messages before they are exported to Oracle

Other

edu.stanford.slac.mpshist.MessageCounter
  • There are various message types that we display in human readable form
    • Beam destination: Beam destination changed from PREVIOUS DESTINATION_NAME to CURRENT DESTINATION_NAME
    • Beam rate: Beam rate rate after DEVICE_NAME changed from PREVIOUS RATE_NAME to CURRENT RATE_NAME
    • Fault: DEVICE_NAME FAULT_NAME changed from PREV_STATE to CURR_STATE
    • Bypass time: DEVICE_NAME FAULT_NAME is bypassed for BYPASS_TIME_IN_SECONDS sec OR DEVICE_NAME FAULT_NAME bypass had cleared
    • Bypass value: DEVICE_NAME FAULT_NAME changed from PREV_VALUE to CURR_VALUE
  • A thread-safe way to count messages, both received and exported, and periodically put the numbers into cmlog
  • Primarily used for debugging
edu.stanford.slac.mpshist.

...

message.MessageRepository
  • A singleton that caches MPS messages before they are exported to Oracle

Other

edu.stanford.slac.mpshist.

...

MessageCounter
  • A thread-safe way to count messages, both received and exported, and periodically put the numbers into cmlog
  • Primarily used for debugging
edu.stanford.slac.mpshist.MessageExporter
  • An instance of Runnable that periodically saves messages to the Oracle DB
edu.stanford.slac.mpshist.MessageServer
  • An instance of Runnable that caches messages from MPS in memory
  • Tries to
  • An instance of Runnable that caches messages from MPS in memory
  • Tries to create a ServerSocket bound to a port specified as an argument to the constructor

...

Release with Eclipse

  • Add a note in $MPSGUI$MPSHIST_ROOT/RELEASE_NOTES
    • Increment the tag version accordingly
  • Commit to CVS
  • Tag with mpsconfigmpshist-R#-#-#
  • Check out the tagged version into production
    Code Block
    cd $PHYSICS_TOP/release
    cvs co -r mpsconfigmpshist-R#-#-# -d mpsconfigmpshist-R#-#-# physics/mps/mpsconfigmpshist
    
  • Select File => New Java project => Create project from existing source
  • Select $PHYSICS_TOP/release/mpsconfigmpshist-R#-#-#
  • Name the project mpsconfigmpshist-R#-#-#
  • Press "Finish"
  • Right-click on the new project mpsconfigmpshist-R#-#-# => Export...
  • Select Java => JAR file
  • Check mpsconfigmpshist-R#-#-# in "Resources to export"
  • Check "Export generated class files and resources"
  • As the export destination, type (and/or select)
    Code Block
    $PHYSICS_TOP/release/mpsconfigmpshist-R#-#-#/jar/mpsconfigmpshist.jar
    
  • Press "Finish"
  • Move the symbolic link
    Code Block
    cd $PHYSICS_TOP/
    rm -rf mpsconfigmpshist; ln -s release/mpsconfigmpshist-R#-#-# mpsconfigmpshist
    

Starting and Stopping

  • Only one Launch MPS GUI from lclshome
  • MPS Global => MPS GUI...
  • MPS Global => MPS CUD...
    MPS History Server (mpshist) is a server application for saving MPS messages to Oracle.

Starting and Stopping

  • Only one MPS History Server is active at is active at any time
  • To start a new server, you must login as laci on lcls-daemon2
    Code Block
    /etc/rc3.d/S99st.mpshist start
    
  • To stop a production server, type
    Code Block
    /etc/rc3.d/S99st.mpshist stop
    

...

Code Block
//#define HISTORY_SUPER_TIMESTAMP_SECPASTEPOCH(_pointerToHistoryData)          
//#define HISTORY_SUPER_TIMESTAMP_NSEC_PULSEID(_pointerToHistoryData)          
//#define HISTORY_SUPER_TIMESLOT(_pointerToHistoryData)                        
//#define HISTORY_SUPER_TYPE(_pointerToHistoryData)                            
//#define HISTORY_SUPER_ID(_pointerToHistoryData)                              
//#define HISTORY_SUPER_OLD_VALUE(_pointerToHistoryData)                       
//#define HISTORY_SUPER_NEW_VALUE(_pointerToHistoryData)                      
  • Beam destination: Beam destination changed from PREVIOUS DESTINATION_NAME to CURRENT DESTINATION_NAME
  • Beam rate: Beam rate rate after DEVICE_NAME changed from PREVIOUS RATE_NAME to CURRENT RATE_NAME
  • Fault: DEVICE_NAME FAULT_NAME changed from PREV_STATE to CURR_STATE
  • Bypass time: DEVICE_NAME FAULT_NAME is bypassed for BYPASS_TIME_IN_SECONDS sec OR DEVICE_NAME FAULT_NAME bypass had cleared
  • Bypass value: DEVICE_NAME FAULT_NAME changed from PREV_VALUE to CURR_VALUE

User's Guide

...

Troubleshoot

  • The clearest sign of problems is an empty table in the HistoryViewer tab on the MPS GUI
  • Every few months, there seem to be weird socket exceptions that don't halt the server (to be investigated)

Log files

  • Check /u1/lcls/tools/mpsHistoryServer/mpshist.log

Cmlog

  • To check for cmlog messages, specify "MPS History" as facility.

Is the server running?

  • To test whether the Server is running, go as laci to lcls-daemon2
    Code Block
    
    ps -ef

...

  •  | grep mpshist
    
  • Also, check nohup.out in laci's home directory

Is the server working?

  • To test whether the server is working, use

...

Verify in the MpsGui (not in cmlog).

...

  • POSI:EP02:400:MTLM_LGC_BYPV

...

  • , e.g.
  • Code Block
    
    

...

  • caput POSI:EP02:400:MTLM_LGC_BYPV 1
    
    wait 10 seconds!
    Code Block
    
    caput POSI:EP02:400:MTLM_LGC_BYPV 0
    
    Verify that there is a message in the MpsGui (- not in cmlog).

Reboot

CTRL-a then d to exit
Note: Wait > 20 seconds before restarting the history server.

Cmlog

...

References

...

http://java.sun.com/docs/books/tutorial/networking/ (esp. sockets and datagrams)
http://darksleep.com/player/JavaAndUnsignedTypes.html (java types from/to bytes)
MPS Fault Logging Statistic Reports