Lex Johnson's rule of thumb about control block usage was posted to the foxboro@freelists.org mailing list in May 2007.

1. Do it in regulatory control blocks (most efficient, least prone to problems).

2. If the regulatory control blocks can't do it, use a CALC block (efficient, but must deal with BAD and coding errors; debugging is a pain).

3. If the CALC block can't do it, use a sequence block (pretty inefficient, but in the CP, so it's redundant; code/compilation relatively complex; debugging is a pain).

4. If you can't do it in a sequence block, reconsider if you need to do it.

5. If you must do it, see if you can do it in a shell (sh, ksh, csh, perl, etc.) script (easier to debug, easy to schedule, remember to use omgetimpand omsetimp to avoid broadcasts, remember to use show_params to check the IMPORT table).

6. If you can't do it in a script, reconsider doing it.

7. If you must do it, see if a third-party or Foxboro package will do it. (Ask on the mailing list.)

8. If you must do it and can't find a package, write a program.

Addendum (5 Sept 2008):

If you are going to use HLBL, keep the following in mind:

  • 1 line of HLBL code is roughly the same load as an AIN block.
  • External OM variable references, e.g., :C:B.P when the compound is in a different CP, suspend the block for one full block period. Thus, 20 lines setting values will take 10s to execute if the PERIOD is 0.5s.
  • Internal block references don't suspend the block, but they are slower than you might expect and will have an impact on your loading if you have enough of them.
  • Remember that code runs until it hits a WAIT, WAITUNTIL, External Reference, or BPCSTM is reached.
  • Remember that if you don't loop you code back to the top (yes, with a GOTO), it will reach the end of the block and stop.
  • Remember that ACTIVE and MA must both be set to true for the block to run.

added to The Cassandra Project Wiki by Duc M. Do, 15 May 2007.