Carnegie-DIMM Documentation

Program Flow Chart

(2010-08-26)

Christoph C. Birk (birk AT obs DOT carnegiescience DOT edu)
The Observatories of the Carnegie Institution for Science (Carnegie Observatories), Pasadena, CA


Abandoned - This document will be integrated into the CDIMM-v2 (MacOS) documentation
Summary
Detailed Program Flow (under construction)


Summary

Version 1.12 (and earlier) of the C-DIMM software assumes that
  • The CCD is powered up
  • The telescope is powered up and aligned
  • The MASS is powered up and Turbina is running (if enabled in cdimm.ini)

    The only difference in v1.13 is that the software turns on the power to the telescope and CCD at startup and then continues as before. This might lead to problems if these devices need some time to boot. This is something we have to work on.

    After the startup of cdimm.exe, the program initializes internal variables depending on the CCD (ST-5,ST-7) and the telescope and prizm geometry. Then it opens communications with the CCD (eg. turn-on the cooling) and the telescope.
    If the cdimm.ini:"auto-dimm" parameter is '1', then the software immediately starts the AutoDIMM mode, otherwise it awaits user input.

    Note: The weather status is taken from the File->Meteo menu as a proxy for the real weather conditions and may be used by the operator as a simple (1-click) way to stop observations and close the dome.

    Once the AutoDimm mode is enabled the system should work fully automatic executing the following tasks:

    • If the dome is closed - but the sun is below twilight altitude AND the weather is ok
      • wake up the telescope (if asleep)
      • start the CCD cooling
      • open the dome
      • start observations
    • If the dome is open - but the sun is above twilight altitude OR the weather is bad
      • close the dome and stop observations
      • put the telescope into sleep mode
      • turn-off the CCD cooloing
      • put the MASS into 'park' mode (if enabled)
    • Select a star from the catalog. The algorithm considers the brightness, airmass, azimuth, minimal zenith distance, etc. and the number of previous rejections (star not found or too faint) ... todo explain algorithm
    • Move the telescope and center the star
    • Take the MASS background measurement (if enabled)
    • Start the DIMM measurement
    • Start the MASS measurement (if enabled)
    • Evaluate the focus after each exposure sequence and adjust the focus if necessary


    Detailed Program Flow

    Program Initialization: (run once at startup)
    setup_constants() [cdimm.c]
    {
    • setup telescope geometry and CCD specific values
    • set system_initialized = FALSE
    }
    if (cdimm.ini:"auto-setup",default=yes) then call setup_hardware() [cdimm.c] in background thread
    {
      if (cdimm.ini:"dome-host",default=no) then
      {
      • power up telescope
      • power up CCD
      • check dome status
      • check fan and lamp power status
      } else {
      • assume power to CCD and telsecope is ON
      • assume dome is closed
      • ignore (non-existent) fan and lamp
      }
      initialize telescope [teledlg.c:do_tele_init()]
    • todo show list of commands used
      initialize CCD [dacq.c:do_ccd_init()]
    • todo explain details
      set system_initialized = TRUE
    }
  • create GUI
  • set setup_stage = TRUE
  • start Timer (2 seconds interval)
  • enter Windows event loop

  • Timer Function: (called every 2 seconds)

    if (NOT system_initialized) then return

    if (setup_stage) then
    • open Telescope, SkyMap and ObjectList windows
    • if (cdimm.ini:"supervisor",default=no) then open sockets
    • if (cdimm.ini:"auto-dimm",default=no) then set auto_dimm = TRUE
    • set setup_stage = FALSE

    if (lamp_power ON) then
    • if (lamp on for more than 2 minutes) then turn off lamp

    if (telescope slewing) then
    {
    • if (telescope NOT stopped) then return
    • set new object name
    • calculate expected flux
    • if (telescope and DIMM in auto-mode) then

      {}
    }

    if (do_mass_background() running) then
    {}

    if (do_center() running) then
    {
    • if (centering NOT done) then return
    • if (star NOT found) then
      {
      • set have_dimmstar = FALSE
      • increment not_found counter for this star (reduces likelyhood of this star to be selected again)
      • increment global not_found counter
      • if (not_found == 3) then set METEO==BAD and suspend operations for 30 minutes
      } else {
      • set have_dimmstar = TRUE
      }
    }

    if (focussing) then
    {
    • if (do_tele_focus() NOT done) then return
    • set focussing = FALSE
    }

  • if (dome_moving) then return
  • if (centering) then return
  • update zenith distance correction
  • if (DIMM measurement running) then return
  • if (MASS measurement running) then return
  • update Moon and Sun positions
  • if (new day) then change logfile name

    todo explain state at some critical points
    
    if (AutoDIMM mode enabled) then
    {
      if (dome NOT open) then
      {
        if (sun_altitude below twilight AND METEO == OK) then
        {
        • wake telescope: do_tele_init()
        • wake CCD: do_ccd_init()
        • set have_dimmstar = FALSE
        • start open dome [dome.c]
        }
      } else { (dome is open)
        if (sun_altitude above twilight OR METEO == BAD) then
        {
        • set have_dimmstar = FALSE
        • sleep telescope, CCD and MASS
        }
      }
    }

  • if (dome NOT open) then return
  • if (AutoDIMM mode NOT enabled) then return
  • update Alt/Az of telescope

    if (telescope Auto mode enabled) then
    {
      if (have_dimmstar == TRUE) then
      {
      • xxx
      } else { (we have no dimm-star)
      • xxx
      }
    }

    if () then
    {
    • if () then return
    }

    check Alt/Az
    telescope in auto-mode ?
    evaluate current star
    find new star ?
    focus in auto-mode ?
    check focus - move focus
    start DIMM measurement
    start MASS measurement

  • Time-stamp Counter

    The Pentium class CPU has an instruction to read the current time-stamp counter variable, which is a 64-bit variable, into registers (edx:eax). The TSC (time stamp counter) is incremented every cpu tick (1/CPU_HZ). For example, at 1GHz cpu, TSC is incremented by 10^9 per second. It allows to measure time in an accurate fashion.
     static __inline__ uint64_t rdtsc(void)
     { uint64_t rval;
            __asm__
      volatile ("rdtsc" : "=A" (rval));
      return rval;
     }
    


    Christoph C. Birk (birk AT obs DOT carnegiescience DOT edu)