User Tools

Site Tools


wonham:sctool

sctool - Supervisory Control Tool

We are developing a more user-friendly Python variant of the Wonham tct tool that can help you develop supervisory controllers. This tool is called sctool and it has been installed at our Linux serack systems.

Like many of the svctools, sctool has been written in Python. This means that the tool should also run at the Windows platform. Feel free to try it. If you need a Python environment for Windows, you could try ActivePython.

Installing sctool under Windows

After unpacking the tar.gz file in a temporary directory, open a Command Prompt window and go to that directory (Where file setup.py is located.) Do the following:

  • Make sure you have at least Python 2.3 installed
  • Enter the command python setup.py install. This should build and install svctools
  • In the scripts directory of your Python distribution, append the .py extension to the following files: ads2stm, gen-chi, gen-dot, sctool, stm2ads, stm2fsm. This restores the file association with Python. (Linux does not need them, so they are not there)
  • Extend your PATH environment variable with the path to the files in the scripts directory so you can call a utility from anywhere…
  • Remove the files in the temporary directory where you downloaded sctools.

So, to start up sctool for instance, you would enter sctool.py in a Command Prompt window (Select Start→Run, entering cmd as program you want to run gives you a Command Prompt window in which you can start sctool.py). After that, you are in the SCT command environment.

Starting sctool

Starting the sctool is done by simply entering its name at the command line:

$ sctool
SCT: Supervisory Control Tool, written by H.A. de Vos
Copyright (c) 2006, Systems Engineering group,
Department of Mechanical Engineering,
Eindhoven University of Technology,
The Netherlands

Type 'help' for a list of available commands
SCT$ 

Note While Herman de Vos implemented most code of sctool, he does not maintain the tool. For bug reports, questions, remarks, enhancement requests, and other questions regarding sctool, always contact a.t.hofkamp@tue.nl.

sctool gives you an interactive environment where you can derive a supervisory controller. In the environment, variables exist that contain a Wonham state machine, and you can compute new state machines by entering commands.

sctool has no editor for entering a state machine, so you have to prepare them beforehand. Two of the more popular ways of doing this are

  • create them with a text editor, or
  • create them interactively with another tool, for example tct, then convert them to the correct format.

Details about this process can be found at creating and editing state machines.

Loading and saving state machines

Once you have the necessary files with state machines prepared, you can load them in sctool:

SCT$ ma = loadsct "ma.sct"
SCT$ mb = loadstm "mb.stm"

These two commands load files ma.sct (in sctool's own file format) and mb.stm (in statemachines file format) into the tool, and assigns them to variables ma respecitvely mb.

The available variables can be listed by entering

SCT$ show

Displaying the contents of a single variable for example ma is done by entering

SCT$ show ma

Even for small state machines, interpreting the output is already difficult. To solve this problem, sctool also provides commands for saving state machines. Once saved, you can use other tools to perform further processing steps (eg generate nice pictures of the state machine, or generate chi code).

Saving is done by the save commands, like

SCT$ savestm ma "ma.stm"
SCT$ savesct mb "mb.sct"

which gives you two new files ma.stm, and mb.sct containing the same state machines just loaded, except in the other file format.

Computing new state machines

The real power in sctool is that it can compute new state machines from old ones. The table below shows the available commands:

Example Description
p = meet q r Compute the meet of machines q and r, and put the result in p
p = sync q r Compute the sync of machines q and r, and put the result in p
p = trim q Compute the trim of machine q and put the result in p
p = selfloop q [ a b ] [ c ] Add selfloop of controllable events a and b, and uncontrollable event c to machine q and put the result in p
p = supcreate [ q r ] [ v w ] Compute the supervisor for machines q and r with specifications v and w, and put it in p

Other commands

Last but not least, sctool has a few other useful commands. They are listed in the table below:

Example Description
! ls Run a shell command from sctool, in this case “ls
shell ls Same as “! ls
quit Stop sctool
exit Same as “quit
wonham/sctool.txt · Last modified: Tuesday, 13 February 2007 : 14:13:00 (external edit)