General Controller

From SysCAD Documentation

Jump to: navigation, search

Navigation: Main Page -> Models -> Process Control Models


Contents

General Description

This is used to simulate plant control, plant operations or calculate displays. This model is often used to customise or extend the functionality of a standard unit operation. These functions may be as simple or complex as may be required.

The General Controller reads a text file, set up by the user, which allows the user to include fairly powerful programming functions. The files are known as "pgm" files and are detailed in a separate section of the documentation PGMs. The control logic (or program code) that you write for a General Controller is executed once every iteration.

The PGM language includes the following capabilities:

  • Accessing tags by name within any unit or stream on the flowsheet.
  • Modification of any permissible tags within any unit or stream on the flowsheet.
  • Real, Integer and Boolean arithmetic.
  • Strings and string manipulation routines.
  • Declaration of user tags (PGM variables) which are then accessible at run time for view, change, reporting, trending, etc.
  • General-purpose functions and classes may be defined and used.

This document only describes the access window for the general controller, and some of the more common problems that may occur. The PGM help documentation contains examples of pgm files and various applications that can be simulated using this model.

For dynamic projects this is used extensively to simulate the control system as well as operator actions. It can be used to simulate events, for example the random failure of equipment.

Tags that are controlled (using SetTag) or referenced (using GetTag) by the General Controller will have a coloured triangle shown in the access window of that unit. When the user right clicks on one of these referenced tags it will indicate which controller is referencing the tag. See Controlled and Referenced Variables.

Location of Control Text files

  • When the user creates a control file, SysCAD automatically creates a sub-folder in the project called Controls and stored all control files (with the extension .pgm) in this folder.
  • The user may store the control files in any other location, although this is not recommended.
  • The user may view the location of all the control files in a project by accessing Project Window - Files List.

Similar Models

  • Set Tag Controller - the user may carry out the simple ratio control and set multiple tags using the the Set Tag Controller model.


Diagram

Image:Models-Controller-Image001.gif

The diagram shows the default drawing of the General Controller.

Inputs and Outputs

There are no connections to this unit.

Model Theory

The power of this model is contained in the program (PGM) written by the user. The pgm syntax for programing the control file is described in PGM Documentation.

Data Sections

The default sections and variable names are described in detail in the following tables. The default General Controller access window consists of one section. The user may set up variables in the pgm code that will be shown on the access window. The number of sections in the access window will depend on the number of variables chosen,

The first section, which has the same name as the General Controller tag, contains general information relating to the unit.

First Section - Tag Name

Tag / Symbol

Input / Calc

Description

Common First Data Section

 

PGM_Name

Input

The user types in the name of the pgm file required for control. The file can be entered in any text editor, and must have the file extension 'pgm'. The user need not always type in the full path of the file. SysCAD will first attempt to locate the file in the project folder, then in the cfgfiles folder. If the file is in neither of these folders, then the user should include the path of the file. If the unit cannot locate the file, it will alarm and send an error message to the 'State' box - NO PROGRAM. The easiest way to load in the pgm file is to use the Browse PGM button.

PGM_Path

Feed Back

The full path of the pgm file is displayed here.

On

Check Box

The user may enable or disable the general controller using this box.

AutoReLoad

Check Box

The pgm will be automatically re-loaded if the file has been changed and saved.

State

Output

The state of the PGM file once a load has been attempted. If everything is correct and operating normally, the user will see 'OK' in this box. Otherwise the unit will flag an error message which helps the user to locate the problem with the controller. These messages are also displayed in the message window.

Errors:

MSG_1 to MSG_4

Output

These message lines are used to report PGM compile errors or errors while the PGM code is executing.

Edit PGM

Button

This allows the user to edit the specified PGM file, normally using the Notepad text editor.

Reload PGM

Button

This reloads and recompiles the PGM code. Use this after changes to the PGM code have been made and saved. This is not necessary if the AutoReLoad check box is ticked.

Browse PGM

Button

This is used to locate a PGM file.

Check Tags

Button

This can only be used while SysCAD is not solving or running. It is used to check all the tags used by the pgm and their engineering units. This is done automatically when the solver starts, so you do not need to use this button.

NewInclude

Input

The user types in the name of the include file required to assist with control. The file can be entered in any text editor, and must have the file extension 'pgm'. The user need not always type in the full path of the file. SysCAD will first attempt to locate the file in the project folder, then in the cfgfiles folder. If the file is in neither of these folders, then the user should include the path of the file. If the unit cannot locate the file, it will alarm and send an error message to the 'State' box - NO PROGRAM.

Watched Variables

Variable

Any variables that the user specifies as 'watched' will be shown on one or more tab pages. This may include calculated variables, which may not be changed by the user, or variables that the user may change during execution of the program.

Adding this Model to a Project

Insert into Configuration file

Sort either by DLL or Group.

 

DLL:

Control1.dll

Units/Links

Control: General

or

Group:

General

Units/Links

Control: General

See Project Configuration for more information on adding models to the configuration file.


Insert into Project

 

Insert Unit

Control

General

See Insert Unit for general information on inserting units.

Hints and Comments

  1. If the pgm file contains a tag that is invalid, SysCAD will not begin execution, but will flag that user that there is an error in the pgm. Check the Messages window for a list of the invalid tags.
  2. If the user edits the pgm file, loads it using the 'Reload' button, but does not see the expected changes, it may be that the pgm file has not been saved before reloading.
  3. If there is more than one copy of the pgm file in various folders, it is always a good idea to open the file using the 'Edit' button on the access window. This will ensure that you are editing the file that the unit is accessing.
  4. It is always a good idea to pause or stop the SysCAD execution before reloading a pgm file into the general controller. This is because if there is an error in the file, the unit will cease all control functions, which may cause problems in the project.

Please see Example PGM Files for an example of a simple PGM file.

Personal tools
Document Sections