Kitt Peak National Observaotry - Home Page


Logging 4 Meter Telescope
Oil and Floor Temperature Control Data


click to view the OFTC log file

Python Powered


To provide a new database of the 4 Meter Telescope's Oil and Floor Temperature Control history, a new logging program has been written using the Python scripting language.

The new OFTC logging program is run as a cron job every 15 minutes. Seventeen individual Oil and Floor Temperature Control data points are recorded during each log file write.

The data collected includes time stamped telemetry for the current oil and floor temperature set point values, as well as temperature control feedback values from both the support oil cooling system, and dome floor cooling loop.


Log file column legend:

  1.Date 
  2.Time 
  3.Year 
  4.Oil Set Point 
  5.Oil Glycol Supply 
  6.Oil Glycol Return 
  7.Oil Heat Exchanger Supply (equivalent process value) 
  8.Oil Heat Exchanger Return 
  9.Oil Pad Return North 
  10.Oil Supply Pressure 
  11.Hammerhead Air Temperature 
  12.spr 
  13.tb1 
  14.Floor Set Point 
  15.Floor Glycol Supply 
  16.Floor Glycol Return 
  17.Floor Temperature Surface (equivalent process value) 
  18.Floor Temperature In Floor (front of telescope) 
  19.Floor Temperature In Floor (under telescope) 
  20.spr 
  21.spr 
  22.spr 
  23.tb2 

 

Python source code: oftc logging program




#! /usr/local/bin/python

        #**********************************************************#
        #                                                          #
        #      4m OFTC Logging Program, Bill Gillespie, NOAO.      #
        #                    March 20, 2003                        #
        #                                                          #
        #       **********************************************     #
        #                                                          #
        #  This program's basic function is to querry and log data #
        #  strings from the 4 meter telescope facilities           #
        #  Oil and Floor Temperature Microcontroller.              #
        #                                                          #
        #**********************************************************#
		

#-------  Fetch modules  ----------------------------------------------------#
#-------  the pyserial module had to be installed for this program  ---------#

import serial, os, sys, time, string


#-------  Get Time String ---------------------------------------------------#

timenow = time.ctime(time.time())
timenow = timenow[4:25]


#-------- Set up the serial line for R/W ------------------------------------#

dev=serial.Serial('/dev/tty***', 4800, 7, 1, timeout=1)
dev.flush()


#-------- Fetch the main values with oftc device calls  ---------------------#

dev.write('oftv\r')
OFTV = dev.readlines()
OFTV = `OFTV`                       # OFTV converted from object to a string
dev.flush()

dev.write('osetpoint?\r')
Oset = dev.readlines()
Oset = `Oset`                       # Oset is now a string (was object)
dev.flush()

dev.write('fsetpoint?\r')
Fset = dev.readlines()
Fset = `Fset`                       # ditto above
dev.flush()


#-------  Print the TIME string to the log file ------------------------------#

LogFile = open("/usr/local/gui/oftc/oftc-log-file.txt", "a")
LogFile.write("%-22s" % (timenow))


#-------  Clean data strings of unwanted characters --------------------------#

OFTV = OFTV.replace(","," ")
OFTV = OFTV.replace("'"," ")

Oset = Oset.replace(","," ")
Oset = Oset.replace("'"," ")

Fset = Fset.replace(","," ")
Fset = Fset.replace("'"," ")


#-------  Parse strings and print log data to log file -----------------------#

OilSetPt = string.split(Oset)             # splits the string into list based on white space.
LogFile.write("%5s" % OilSetPt[2])        # prints new list item 1, to the log file.

(OGS, OGR, OSX, OXR, OPR, OSP, AMP, spr, tb1) = string.split(OFTV)[12:21]
LogFile.write("%5s %5s %5s %5s %5s %5s %5s %5s %8s" % (OGS, OGR, OSX, OXR, OPR, OSP, AMP, spr, tb1))

FloorSetPt = string.split(Fset)           # splits the string into list based on white space.
LogFile.write("%5s" % FloorSetPt[2])      # prints new list item 1, to the log file.

(FGS, FGR, FT1, FT2, FT3, spr, spr, spr, tb2) = string.split(OFTV)[32:41]
LogFile.write("%5s %5s %5s %5s %5s %5s %5s %5s %8s" % (FGS, FGR, FT1, FT2, FT3, spr, spr, spr, tb2))

LogFile.write("\n")
LogFile.close()


#-------  flush and close the serial line -----------------------------------#

dev.flush()
dev.close()








Bill Gillespie
Kitt Peak National Observatory
Observing Support Office
gillespie@noao.edu

Last update - Mar 20, 2003