[MAT logo][Prev][Up][Next]

mattest / plctest

This is MatPLC's Swiss Army Knife. It can be used to get and set the values of points, wait for a particular point or synch point from a script, and a few other miscellaneous debugging things.

Note: this tool has been recently renamed: it used to be called "plctest" but is now called "mattest". The functionality is unchanged.

For using it from a script, it's probably a good idea to use the -q option, which switches it to quiet mode. In quiet mode, plctest only outputs the requested data (and any errors).

Getting and setting points

To read a point, use the -g option, like this:
plctest -g pt_name

If the point is a floating-point number, you'll get some strange number. To convert it to a float, use the -f option, like this:
plctest -f -g pt_name

It's also possible to set points, but note that only the owner of a point can set it. You can get plctest to pretend to be the owner, but if the real owner is already running, it will overwrite your value in short order. So this is only useful in limited circumstances. The syntax is similar to the above, though:
plctest -s pt_name -v value
plctest -f -s pt_name -v value

Display all points

As a debugging tool, it's often useful to be able to see what's happening inside a PLC. While a full-fledged displayer is not yet written, plctest contains a quick, simple one.

On screen

This simply displays all the points in four columns and repeats until you kill it (Ctrl-C).
plctest -d

HTML (Web / Intranet)

This feature is also available via a web browser. If you run
plctest -dh
it will output a HTML table with the point names in the left column and the values in the right column. So you might have a CGI script, perhaps a bit like this:

    cd .../mat/demo/basic
    echo Content-type: text/html
    echo ""
    ../../tools/run/plctest -dh
Or, more sophisticated:
    cd .../mat/demo/basic
    echo Content-type: text/html
    echo Refresh: 10
    echo Pragma: no-cache
    echo ""
    cat preamble
    ../../tools/run/plctest -dh
    cat postamble


Similarly, the data can be output in the XML format. The command
plctest -dx
will output simple XML containing the points (names and values).


plctest can wait for a synch point or until a particular point is on. This can be useful in scripts, to avoid looping in the script.
plctest -u pt_name
plctest -w synchpt_name


plctest can also run an empty scan loop. This can be used to practice synch, as it prints out loop counts each time through (unless you use the -q option).
plctest -l


$Date: 2005/05/07 07:43:45 $