COGENT Online
CONTENTS
COGENT Help

Running Models

Introduction

Once a model has been drawn and the details of each of its boxes have been specified, it can be run by clicking on the Run... button on the top line of the model's main window. The window that then appears provides an interface to the underlying execution engine. With this window, the user can step through the model's execution or run a whole block of trials. In addition, whilst the model is running, the user can watch messages being received and processed by boxes by opening the boxes and displaying the current state or message log.

Note: It is currently not possible to have more than one run window present at a time. This is due to the way in which the underlying execution model is invoked and limitations in the XView windowing widgets. If you try to open a run window when one such window is already present, the first window will safely abort.

The Execution Model

The model of computation used by all COGENT cognitive models is based on the parallel cyclic execution of each box. A COGENT specification of a model is effectively a specification of the initial state of each box together with a specification of a state transition function for each box. Within this execution model, communication between boxes is handled by simple message passing: messages are removed from a bus at the beginning of each cycle, processed, and then results are placed onto the bus at the end of each cycle. This execution model is both simple and effective.

Initialisation and Experiments

Before it can be executed, a model must be initialised; this empties boxes of their current contents and message lists, and loads relevant boxes with their initial contents. Some box types, such as buffers, have properties which govern when they are initialised, allowing them to accumulate information across a sequence of trials, blocks or even subjects if required.

Boxes can be initialised on each trial, each block, each subject or each session. Correspondingly, there are four levels of initialisation. As well as initialising the appropriate boxes, these levels of initialisation interact with the trial, block and subject counters, such that when, say, a subject initialisation occurs, the subject counter is incremented and the block and trial counters are reset. These counters can be queried by means of special conditions, intended for use by "Experimenter" boxes to facilitate data gathering and analysis.

While developing a model, the different initialisation levels will not generally be required; in such circumstances the default, Initialise Session, which initialises everything and resets all counters, should be adequate.

Running a Model

The run window consists of four sections. From top to bottom these are: a panel of buttons which control the model's execution and the window itself; a text window which displays output from the underlying Prolog process as the model is executed (this information can generally be ignored); a further panel containing information and buttons relating to the output generated by the model; and a canvas in which that output is actually displayed.

The run window has two modes, trial mode and block mode. A trial is one complete run of a model. It consists of a sequence of cycles and is most useful when developing and debugging a model. A block is a sequence of trials. It is most useful when the model is known to work as intended and it is time to perform a complete experiment. The mode in which the window first appears is controlled by the ``Default block execution'' configuration option. The left-most menu button on the top row of the run window allows the user to switch between modes.

Trial Mode

The only difference between trial and block mode is the set of buttons displayed on the top row of the window. In trial mode the buttons allow:

The Initialise and Step buttons both conceal pull-down menus:

The value of Cycles/Step can be set either by positioning the cursor over the corresponding text field and typing an integer, or by clicking on the up/down buttons beside the text field. Adjusting the step size is particularly useful if you are debugging a model and know that it performs correctly until (for example) cycle 29. You can then initialise the model, set cycles/step to 29, perform one step (taking you to cycle 29), set cycles/step back to 1, and then examine the model's behaviour on the crucial cycle.

Clicking the Stop button while a model is running will stop model execution cleanly; afterwards it is possible to continue stepping through the trial using Step, or to complete the trial using Finish Trial.

The Help... button pops up a window containing the text from this document.

The Done button destroys the run window. Pressing this button when the model is still running is not advisable, as the model may not be restartable afterwards without re-initialisation, so you should use the Stop button first. However, this may be the only option if that process is running out of control (e.g., it is is in an infinite loop).

Block Mode

In block mode the buttons on the top row of the window allow:

The Initialise and Run buttons both conceal pull-down menus:

By adjusting Trials/Block you can run a sequence of many trials. This is most useful when the model contains some random element (e.g., random access to, or decay from, a buffer), so that its output may differ on successive runs, and the effects of that randomness are to be determined. The value of Trials/Block can be set either by positioning the cursor over the corresponding text field and typing an integer, or by clicking on the up/down buttons beside the text field.

Clicking the Stop button while a model is running will stop model execution cleanly; afterwards it is possible to continue execution using Finish Block, or to switch to Trial Mode and use Step or Finish Trial.

The Help... button pops up a window containing the text from this document.

The Done button destroys the run window. Pressing this button when the model is still running is not advisable, as the model may not be restartable afterwards without re-initialisation, so you should use the Stop button first. However, this may be the only option if that process is running out of control (e.g., it is is in an infinite loop).

The Output Trace

The output trace forms the lower half of the run window. Any output generated when running a model, including initialisation and termination messages, as well as all messages received by data sinks, appears in this window. The label above the window indicates where in the current execution the system is up to (in terms of cycle, trial, block and subject numbers).

The output trace window is a ``pagable'' canvas. This means that it has a pair of buttons immediately above the window which allow you to page forwards and backwards through any output (provided there is more than one page of output).

The contents of the trace may also be printed (via the Print button) or cleared (via the Clear button). Note that these buttons function independently of the model's execution, so it is fine to print or clear a trace while the model is running.

Tracing and Debugging

Models rarely work first time as intended. COGENT provides some tracing facilities to assist with debugging in the form of message logs for all boxes and, for those boxes whose contents change, a window onto their current state throughout processing.

To see the current state of any box, open that box and switch its mode to Current State. (Boxes whose current state does not change will not have this option on their mode menu.) It is thus possible to, for example, open up a buffer and watch its contents change as execution progresses. Hence if something isn't quite right, one possible strategy is to step through your model's execution examining the contents of any suspect buffers at each step. A similar facility is available for data sources and data sinks.

Being able to examine the contents of buffers and data boxes doesn't solve all debugging problems. It can also be useful to see the generation and passing of messages. For this reason all messages are logged and the messages received and sent by any given box can be examined by switching the mode of that box's window to Message Log. Message logs are displayed as pagable canvases (like the output trace), so it is possible to page through the log to see all messages. Further, if the message log is open whilst the system is running, messages will appear in the log as they are generated. Thus in trial mode it is possible to step through and examine the messages generated on any given cycle, and in block mode it is possible to sit back and watch messages arrive and depart.


COGENT Online
CONTENTS
COGENT Help