Fig. .1 Multiple representation of a process variable and information related.

To summarise, the problem consists in the necessity of multi-aspect representation of knowledge about process variables. The main issues include the following:
Fig. .2 Comparison of traditional implementation of a supervisory
architecture and implementation using Object-Variables.

Fig. .4 Object-variables in Simulink allow to encapsulate information to be shared with other blocks.
    Classes of object-variables.

    The use of object-variables is defined to encapsulate information (data and methods) into a data structure to be shared among different tools. It is assumed that an open architecture is used and new tools can be added into the framework. Then, new features may be required to describe system variables and object-variables must be endowed with new methods to supply them. Taking this into account, two possible solutions to modify the structure of object-variables are proposed below.

    The first solution is a straightforward one. It consists in adding new features to the original object-variable, in order to obtain the capabilities required for any newly added tool. In this case, the data structure grows in size and some memory is likely to be wasted, even though not all features will be used but only some of them. This solution, although applicable directly, is not recommended in case of complex systems because of the great number of variables involved.

    The second possibility is to define several object-variables with a simple common structure and particular methods to serve sets of tools with some similarities. This option allows to define more accurate object-variables, fitting the tool requirements in a more exact way; unfortunately in some cases a certain degree of incompatibility with certain tools may occur and more than one object-variable could be necessary to be used for representing several features of a process variable. Both possibilities are represented "Fig. 6".

Fig. .6 Obtaining New object-variables from a basic structure.

    The necessity of having several classes of object-variables is basically due to the necessity of integrating several tools for supporting the design of supervisory structures. The classes of the variables will be defined according to the specific requirements of the applied tools. "Table-1" shows the relationship among the tools to be used to deal with abstracted information at several levels of abstraction and the kind of methods and data to be stored into the object-variables.
Table -1Object-variables definitions according to the tools using such object-variables.
    Several kinds of object-variables can be defined for working at multiples abstraction degrees. The proposal consists in declaring a hierarchy of classes capable of supplying adequate information to any tool. At this moment only two levels have been defined (See Fig. .8 ). The first is assigned to object-variables and to interface numerical process variables with qualitative reasoning tools. For this purpose several methods can be used (abstraction tools, presented in the next subsection). Object-variables can also be used as only qualitative variables without numerical attributes. The second level consist in a higher level structure, grouping object-variables and additional parameters and methods, called facts. These are used to interface a rule-based system avoiding different kinds of data as input. See subsection . Facts can be build directly without containing a complete object-variable inside. This means that they can be used as user input at run time to supply data to an ES.

Fig. .8 Two hierarchical levels of object-variables have been defined.
    The internal structure of these classes is defined according to OOP because of the possibility of embedding data and methods in the same structure, as is exemplified in Fig. 4. Embedding objects into MATLAB/Simulink. Technical viability.

    Due to the relevance of embedding objects into Simulink in respect to this work a brief explanation is added as technical note. Through the mechanism of S-functions defined in Matlab/Simulink, the user can add new general purpose blocks or incorporate an existing 'C' or 'FORTRAN' code into the simulation. The only constraint which must be taken into account is that the new code must be written with respect to the predefined structures or routines. These routines will be called by Simulink at each simulation step.

    'SimStruct'  is the data structure used by Simulink designers to encapsulate the block’s information. Each block in a Simulink representation has an associated ‘SimStruct’, accessed by Simulink to perform simulations correctly. Then, the information embedded in this data structure allows Simulink to know the parameters associated to this S-Function, as well as to access user defined routines.


Fig. .10 Internal structure in Simulink. Solution to embedded objects.
There are three fields where the user can save restricted information in the 'SimStruct' structure, only available for the object owner. These three fields are associated with work vectors that correspond to pointers to integers (int *), to doubles (double *), and pointers to void pointers (void **). In the 'SimStruct', see "Fig.10", these fields are labelled as 'vectors.RWork', 'vectors.IWork' and 'vectors.PWork'. Therefore, the only method to embed external information into Simulink 'SimStruct' consists in using these working vectors.
By taking advantage of this capability, it is possible to associate an object to Simulink blocks by saving a pointer (to this object) in the 'vector.Pwork' field in its 'SimStruct'. Moreover, to each Simulink block there can be an object associated.
In order to assure correct work of the components together, some further constraints must be taken into account. The source file for getting a .MEX file (as a result of a compilation of an S-function), is structured according to a template structure defined by Simulink developers. This structure is composed of routines where the user can insert his own code. In these routines of the .MEX file under design the following advice must be taken into account:
   
#include "obj_def. h" Class definitions and object access methods can be defined in an include file.
mdlInitializeSizes() A pointer vector will be used and specified using the command 'ssSetNumPWork(S,1)'.
MdlInitializeConditions() Memory space must be allocated, to be used by the object and its pointer. 
mdlOutputs() Methods could be activated to access the desired fields into this routine. 
mdlUpdate() To update and fill the predefined fields of the object.
mdlTerminate()  Remember to free allocated memory.

Table -2 Structure of a C written S-function.


 



 

The fact of working with objects implies using an object oriented compiler, and at the same time, access to data pointers (C++ compiler) must be allowed. In this case, Watcom 10.5 C++ compiler was chosen.