TMCALGO V2R1: Algorithm Compiler

Software Status Example

This example was extracted wholesale from the Total Water and Ozone instrument. The software status variable is called "SWStat", and can be set with the command "SWStatus Set To n". Specific values can be indicated by other "SWStatus" commands such as "SWStatus Shutdown".

I have included a realtime algorithm file input partition here as well, since the two techniques are very often coupled in the lab. Whenever the software status is set to 254, the ReadFile state is validated, causing the file "two.tmas" to be read and executed. (One may wish to include a value to validate ReadFile_idle as well to allow an easy interactive way to abort a realtime file, but note that the same effect can be achieved by removing two.tmas and validating ReadFile.)


# ------------------------------
# Partition 2: Software Status
# ------------------------------

Partition

State SW_Stat_Wait {
  { int reset_it;
    reset_it = 1;
    switch (SWStat) {
        default:
        case 0:   reset_it = 0; break;
        case 254: Validate ReadFile; break;
        case 255: Validate Shutdown; break;
    }
    if (reset_it) Validate SW_Stat_Reset;
  }
}

State SW_Stat_Reset {
  > SWStatus Set To 0
  Hold until (SWStat == 0) or 10;
  Validate SW_Stat_Wait;
}


# ----------------------------------
# Partition 3: Realtime File Input
# ----------------------------------
Partition

State ReadFile_idle {}

State ReadFile "two.tmas" {
  +5 Validate ReadFile_idle;
}

Return to Manuals Guide. Written by Norton T. Allen
Copyright © 2001 by the President and Fellows of Harvard College