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

Config - PLC section

The [PLC] section of the config is used to configure parameters related to the core which have to be the same in all the modules. Some other core-related parameters are module specific, and must be specified under those modules' sections - see the Common configuration chapter.

Module and point tables

Almost every application will have to specify at the module and point tables. They are central to the functioning of the MatPLC.
module
The module table defines which modules should be started by the matplc program when it's told to start up the MatPLC. See the modules chapter for explanation of modules.

syntax:
module <name> <file> [<options> ...]

where:

name
the name of the module. This name will be used in sections, module synchronisation, etc...
file
the program that will be executed.
options
other command line options that need to pe passed to the program. Module-specific options will be documented with the relevant module; most modules also accept the --PLC options documented in the appendix; in particular, use --PLCdebug=9 for increased logging.

point
The point table defines the named points in the plc. See the points chapter for explanation of points.

syntax:
point <name> <full name> <owner> [at <offset>[.<bit>]] [[i|u|f]<length>] [init <init_val>]

where:

name
Name used to refer to the point throughout the matPLC
full name
More extensive description of the point. Currently, this is not used for anything; however, a diagnostic tool could use it to describe points to the operator.
owner
Name of the module with write permission on the point - that is, the module that is allowed to change it.
at
the word 'at'. This indicates that the optional <offset> or <offset>.<bit> specification follows. Usually, this will be omitted and the MatPLC will allocate a slot for the point automatically.
offset
the word in the globalmap to be used
bit
the bit, in the word, that holds the point. If offset is specified, but not bit, bit defaults to 0. Note that a point must not overflow onto the next offset position (i.e. bit + length) <= 32).
i | u | f
one of the letters 'i', 'u' or 'f'. These are used to specify the type of the data in the plc point:
i Signed integer, that is, whole numbers both negative and positive.
u Unsigned integer, that is, whole numbers from zero up (no negative numbers).
f Floating point; this really only makes sense with 32-bit points, otherwise known as f32. Floating point numbers use the standard IEEE representation.

The type specification is optional. There is no default; if the type is not specified, it is treated as unknown.

At the moment this is only used by the MatPLC code to figure out how to interpret the initial value of the point when parsing the init parameter. If the type is unknown, autodetection is attempted (as described below).

length
the size in bits of the point. The length is optional, defaulting to:
  • 1 bit normally,
  • 32 bits if at <offset> is used, and
  • 1 bit if at <offset>.<bit> is used.
init
the word 'init', indicating that the optional initial value follows. If it is omitted, the initial value will be 0 (off).
init_val
the initial value of the plc point. Interpreted according to the i | u | f specification; if the i | u | f is omitted, the initial value will be interpreted as follows:
  • if it contains a decimal point (e.g. 1.1) or an exponent (e.g. 1e9), it will be taken as a a 32 bit float (f32);
  • otherwise, if it has a leading '+' or '-' character, it will be interpreted as a length-bit signed integer (i);
  • ohterwise, the value will be interpreted as a length-bit unsigned integer (u).
Only 32 bit floats, integers or unsigned integers are currently supported; however, shorter integers convert correctly.

Point alias table

The point_alias table defines aliases to the named points. It is optional - in many applications, there will be no need for aliases.

As far as the rest of the MatPLC is concerned, a point alias is exactly the same as a point. Aliases can be used for two purposes:

  1. to have one point referred to by two names, and
  2. to have one point refer to particular bit(s) of another.

syntax:
point_alias <name> <full name> <orig_pt> [<bit> [<length>]]

where:

name
Name used to refer to the point alias throughout the MatPLC.
full name
More extensive description of the point alias - as for a normal point.
orig_pt
The name of the original point.
bit
The first bit of the original point that this alias will reference. This is optional - by default, the alias refers to the whole original point.
length
the size in bits of the alias point. The alias must not overflow outside the original point, so that bit + length <= (length of orig_pt point). The length is optional; if bit is specified but length is not, the alias will refer to that single bit (that is, length=1). If neither is specified, the alias refers to the whole original point.
The owner and initial value are specified on the original point; they don't need to be set here.

Single values

All of these settings have reasonable defaults which will work for the vast majority of applications.
magic_bit_aliases
This is a feature to simplify access to individual bits of multi-bit points. By default it is off, to reduce confusion, but it can be activated by setting it to 1. When active, any time you have a point called foo, it will create aliases foo.0, foo.1 and so on up to the length of the point.

This setting can also appear in the section of a particular module, creating the bit aliases only for that module.

max_modules
The maximum number of simultaneously active modules the MatPLC will ever have.

If this parameter is not specified, a default value (currently 20) is used. Valid values are non-negative integers. The allowable maximum depends on the operating system currently being used and the number of places in the synchronisation Petri Net (see the synch chapter). For example, on a typical linux the total of max_modules plus number of places may be 250 maximum.

confmap_key
The key to use for the confmap shared memory. This is actually the same parameter configured through --PLCplc_id=xxx. The command line argument takes precedence over the value configured in this file.

If this parameter is not specified either way, the default value (currenty = 23) is used. Valid values are positive integers or 0. If 0 is specified, then a random key is chosen.

confsem_key
The id of the sempahore set used by the CMM.

If no value is specified, then the default is used (currently 0). Valid values are positive integers or 0. If 0 is specified, then a random key is chosen.

confmap_size
The size of the confmap given in bytes.

If this value is left unspecified, the default value (currently 8*1024) is used.

globalmap_key
The key to use for the globalmap shared memory segment.

If no value is specified, then the default is used (currently 0). Valid values are positive integers or 0. If 0 is specified, then a random key is chosen.

globalsem_key
The key to use for the globalmap semaphore set used by the GMM.

If no value is specified, then the default is used (currently 0). Valid values are positive integers or 0. If 0 is specified, then a random key is chosen.

globalmap_size
The size of the globalmap given in bytes.

If this value is left unspecified, the default value (currently 8*1024) is used.

synchsem_key
The id of the sempahore set used by the SYNCH sub-system.

If no value is specified, then the default is used (currently 0). Valid values are positive integers or 0. If 0 is specified, then a random key is chosen.

Synch and Real-time

Some of the synch config and real-time config are also in the PLC section; they are covered in the Synch chapter and RT chapter respectively.

Examples

Example 1: Absolute Minimum Configuration
[PLC]
# we need some points:
point P1  "full name 1" module1       # 1-bit point
point P2 "full name 2" module1 5 # 5-bit point
point P3 "full name 3" module2 32 # 32-bit point

[PLC] # We also need some module to execute: module module1 /matplc/logic/... module module2 /matplc/logic/... [module1] # Here go the module-specific configurations for module1 [module2] # Here go the module-specific configurations for module2

[Prev][Up][Next]

$Date: 2006/05/23 09:47:13 $