SPNBOX Functions

General Information and Coding Conventions

The SPNBOX functions are used for supervisory control. For descriptions of the purpose of individual functions see the original Matlab manual. For descriptions of the C interfaces, see the spnbox header file.

There are common patterns in the way parameters are used. In general, matrices as defined in matrix.h in the pntool directory are used to represent Petri net matrices, marking and other types of constraint matrices, and some vectors and are passed to SPNBOX functions by pointer. In general, vectors are represented as integer arrays and are passed to SPNBOX functions as pointers to ints. The size of an array is sometimes determined by context, as from the number of rows in matrix, and sometimes explicitly via an integer parameter.

Return types use similar patterns. Matrices and vectors are represented in similar manners. In addition, some functions returns strings as status indications. The various status messages are defined in spnbox.h. These messages are the same ones used in the original Matlab code.

There are a few coding conventions used in the SPNBOX function implementations.

Some functions can print status messages to stdout during execution. How many of these messages will be printed is determined by a function int is_verbose(), declared but not implemented in general.h. Verbosity is set by a custom implementation of the is_verbose() fuction. The integer returned by the function is the verbosity level. A higher level indicates a request to print more detail. The minimum, 0, means no message except those absolutely necessary should be printed. The maximum is 10. In the SPNBOX functions, each function has a verbosity threshold. It will print its messages only if the verbosity is at its threshold. Thresholds are defined in the main header file. Functions that are called by other functions should have a higher verbosity threshold so that their messages are displayed less readily.

spnbox.h is the primary header file for the SPNBOX functions. It defines all the SPNBOX functions and all the necessary option macros, message strings, return type structures, and a few specialized parameter structures.


Building SPNBOX

To build SPNBOX for use with ACTS, move to the pntool/spnbox/ directory and run make with the default target. This will build all object files for all the SPNBOX functions, as well as the support files used by them.

Note that this will also check to make sure that the support file liblpsolve55.a, the compiled linear programming library, is present. If it is not, the makefile will change directories to the third-party directory where the lpsolve files reside and run its linux-targeted makefile.