# Patent

## Title
Apparatus and method for automatically creating membership functions

## Abstract

An artificial intelligence software shell for plant operation simulation includes a blackboard module including a database having objects representing plant elements and concepts. A rule-based knowledge source module and a case-based knowledge source module, in communication with the blackboard module, operate on specific predefined blackboard objects. The case-based knowledge source module includes cases having past data points on a time scale. Present data is compared with the past data in the cases both on a time scale and on a magnitude scale for determining levels of closeness in time and magnitude. An input data module, in communication with the blackboard module, enables a user to input data to the shell. A control module, in communication with the knowledge source modules and the input data module, receives all input data and controls operation of the knowledge source modules in accordance with a predetermined knowledge source priority scheme.

## Background
This application relates to Application Ser. No. 07/994,668, filed Dec. 22, 1992; Application Ser. No. 07/995,209, filed Dec. 22, 1992; and Application Ser. No. 08/000,873, filed Jan. 5, 1993.

The present invention relates to an artificial intelligence software system for plant operation simulation and, more particularly, to a case-based knowledge source process for such a system.

Factory and processing plant environments are so diverse that they are difficult to describe in specific terms. Many difficulties are encountered in trying to understand plant operation in a general way because of this diversity. There do exist, however, in the field of manufacturing, some common operational characteristics that a factory or processing plant should possess for efficiency purposes. In particular, it has become increasingly desirable for a plant to be operated in an optimal manner with respect to material resources, human resources and time. Areas of focus, in this regard, include the utilization of sound engineering principals, economic planning and safety.

Simulation modules of plant operation, which incorporate specific knowledge of plant operation, aid in implementing such principals in practice. Because of the complexity of most plant environments, however, experts such as manufacturing engineers only have knowledge limited to the particular areas of the plant domain within which they work. This knowledge may exist in different forms ranging from analytical models to heuristics. Because of the incompatibility of the forms of knowledge, it is very difficult to incorporate the knowledge in a complete plant model.

The application of computer technology in the plant environment is commonplace. In all areas of production, one can find computers used for a variety of tasks from control of equipment to data logging. One particular area that is growing is the use of computers to implement knowledge-based systems, or expert systems, in the plant domain to aid in achieving plant operation efficiency. A knowledge-based system contains a representation of knowledge about some aspect of the plant operation, and it provides diagnoses or recommendations by using some form of logical reasoning or heuristics to process the knowledge. The systems represent a distinct use of computers beyond numerically-based applications. Attempts have been made to create a knowledge-based system with which one can combine the power of the computer with the expertise of plant operators to yield a tool that can assist in the operation of the plant, and provide diagnostic information that can be used to monitor the plant and its resources. Because a plant may have many different knowledge sources and expert systems, a method of integration would allow interaction among different systems and would permit broader issues of plant operation to be incorporated within the computation framework. Because of the different forms of knowledge sources and expert systems, such a method of integration has not been achieved to model complete plant operation. In addition, because every plant differs somewhat in specific areas, a system has not been realized which possesses functional modules in an overall structure sufficiently broad to be useful in diverse plant environments.

In order to achieve such a system, it is important to model characteristics of every plant that are common. One such characteristic common to every plant is that in some complex way, inputs (raw materials) are processed to produce outputs (finished products). Another common aspect is that all plants involve processing over time. Unfortunately, a complete analytical description of a plant involving full time dependencies is impractical, if not impossible. Information concerning a plant operation is typically incomplete and fragmentary. Abundant information relating to plant operation, however, may exist, but in order to create a system, it must be gathered and organized into such a system. This has not been done successfully in the past with knowledge-based systems.

Accordingly, a general object of the present invention is to provide a knowledge-based system which possesses functional modules in an overall structure sufficiently broad to be useful in diverse plant environments.

Another object of the present invention is to provide a knowledge-based system which can combine the power of the computer with expertise of plant operators to yield a tool that can provide diagnostic information and monitor operation of the plant.

Another object of the present invention is to provide a case-based knowledge source process in which a comparison scheme provides for comparisons in both a time and magnitude fashion.

To accomplish the foregoing and other objects, features and advantages of the invention, there is provided an artificial intelligence software shell for plant operation simulation which includes a blackboard module including a database having objects representing plant elements and concepts. A case-based knowledge source module including an artificial intelligence operation scheme having time-magnitude scoring, in communication with the blackboard module, operates on specific predefined blackboard objects. An input data module, in communication with the blackboard module, enables a user to input data to the system. A control module, in communication with the input data module and the case-based knowledge source module, receives an input data and controls operation of the case-based knowledge source module.

In a preferred embodiment of the present invention, the shell further includes a rule-base knowledge source module. The rule-based knowledge source module has a forward-chaining belief propogation scheme including rules in if-then-else form with associated levels of belief. The case-based knowledge source module has a data comparison scheme including predefined patterns and conditions, whereupon execution of the case-based knowledge source, the conditions are inferred to be true if a certain level of closeness is found between the received data and the patterns in both time and magnitude scales.

The control module includes an event detector module and an activation/agenda manager module. The event detector module, in communication with the input data module, receives all input data and determines when the knowledge sources should execute, The activation/agenda manager module, in communication with the knowledge source modules and the event detector module, executes the knowledge source modules in accordance with a predetermined knowledge source priority scheme,

Numerous other objects, features and advantages of the invention should now become apparent to those skilled in the art upon a reading of the following detailed description taken in conjunction with the accompanying drawings, in which:

FIG. 1 is a block diagram of the overall system environment of the present invention;

FIG. 2 is a detailed block diagram of the overall system environment of FIG. 1;

FIG. 3 is a block diagram of the blackboard architecture;

FIG. 4 is an overall system block diagram;

FIG. 5 is a block diagram of a blackboard data structure;

FIG. 6 is a list of value type codes for the blackboard;

FIG. 7 is a block diagram of event detector data structures;

FIG. 8 is a logic list of event detector software;

FIG 9 is a list of activation/agenda manager logic flow;

FIG. 10 is a diagram of a rule network example;

FIG. 11 is a diagram of rule-based node structures;

FIG. 12 is a diagram of rule structures;

FIG. 13 is a diagram of rule structures;

FIG. 14 is a list of rule-based knowledge source logic flow;

FIG. 15 is a list of formulas for combining evidence with rule belief;

FIG. 16 is a diagram of case-based knowledge source data structures;

FIG. 17 is diagram of an input data structure;

FIG. 18 is a list of logic flow of user interface software;

FIG. 19 is a detailed system block diagram;

FIG. 20 is a list of data message type codes;

FIG. 21 is a list of control message type codes;

FIG. 22 is a list of message type codes;

FIG. 23 is a list of a particular message format;

FIG. 24 is a list of a particular message format;

FIG. 25 is a list of a particular message format;

FIG. 26 is a list of a particular message format;

FIG. 27 is a list of a system file format;

FIG. 28 is a list of a blackboard structure description file format;

FIGS. 29A, 29B and 29C are a list of a rule-based description file format;

FIGS. 30A and 30B are a list of a case-based description file format;

FIG. 31 is a list of an input data file format;

FIG. 32 is a list of a log file format;

FIG. 33 is a list of a diagnostic file format;

FIG. 34 is a list of a blackboard status file format;

FIG. 35 is a flow chart of a case-based reasoning process;

FIG. 36 is a case-based diagnostics table; and;

FIG. 37 is a time curve for case-based diagnostics.

I. Introduction

The present invention provides an artificial intelligence software shell in which a blackboard database includes objects representing plant items. Expert system knowledge sources, in accordance with a temporal priority scheme, execute and modify specific objects. A user can view the status of the objects to diagnose and monitor plant operation. An application developer (plant expert for a particular application) must develop the objects and knowledge-based rules before the system can be used. A control process, in accordance with the present invention, receives all input data, and determines when each knowledge source should execute, in accordance with a predetermined knowledge source priority scheme.

A case-based knowledge source, in accordance with the present invention, stores cases including data points along a time scale. When the case-based knowledge source is executed, present data (within the blackboard) is compared with a case and, if a certain predefined level of closeness is found in magnitude and time, then a condition is inferred to be true.

The domain shell can be described from two viewpoints. One way to look at the domain shell's organization is from the knowledge-based system functional view. For the domain shell this is a description of the blackboard architecture, its components and their interaction. This is the internal view of the system. The other view is from the user's standpoint, that is, how does the system appear to the user as he interacts with it or uses it. The details of the interfaces and the operating sequences that occur are the external system view. While these representations are different, they are strongly related to each other.

The overall system environment diagram is given in FIG. 1. The domain shell will consist of an environment in which a specific application program can be developed. This is known as the application development environment. It has the functions that are used by the application developer to enter, modify and test the structure for the application. These structures form an instantiation of the blackboard approach, including a control framework. The knowledge sources are created and entered at this stage as well. The domain shell described in this document will contain the tools and framework facilitating the creation of applications for any plant environment. An application developer would benefit from the existence of structures common to his particular plant type. If structures representing equipment types and associated icons were already features of the shell, the developer could use them without having to create them himself. The existence of such tools would also have the benefit of standardizing the graphical appearance of the running system. Clearly, there are types of plants (such as steel mills or food processing plants) which would benefit from having a set of structures that are specific to the plant type (such as icons of a roller press for the steel mill). As a first step, the developer could create a steel mill domain shell by adding to the domain shell the set of structures that would be useful to the application developer in a particular steel mill. Then the application developer in any steel mill could use the created structures, thus easing the burden of development. The increase in value of the plant type specific domain shell suggests that the level of customization of the domain shell be carefully considered to maximize the shell's utility.

After the application development is completed and tested, it is installed on-line in the plant environment. The system then enters the application execution environment. Here the users are the plant personnel that interact with the system to receive the system recommendations and take appropriate action.

FIG. 2 is a more detailed view of the two environments. This shows the distinctions in the two environments. Note that the knowledge-based system framework resides in both environments. The link between these two systems is the compiler, which translates the entered information into a format suitable for real-time operation. Note that the "compiler" is included as part of the App. Der. Env. The knowledge-based system in the development environment is the system that is created by the developer, represented in a form that allows easy editing, manipulating and testing, while the knowledge-based system in the execution environment represents the runtime version of the system, having been modified for compactness and efficient execution. The domain shell specified here can be described in detail by examining these two environments.

The end users are the plant personnel who will use the system in the real-time plant environment. This view of the system emphasizes the details of the interface to the users, and describes the features that include the presentation of information, and the nature of the types of inputs that the user might enter.

The domain shell's architecture will be visible to the end user mainly in the manner of presentation of information. This includes the use of a windowing environment that allows the user access to different levels and types of information. The window environment should be held consistent so that all users maintain familiarity with the mechanics of operation within all parts of a particular application and also across applications.

The system will allow the end user to view the reasoning processes and to be provided with explanations of what the system is doing and why. It is important to maintain the explanation at a simple level, so that the plant operator is not overwhelmed by too much information when faced with the need to make a time-critical decision. However, the generality of the shell will allow the application developer to alter the runtime characteristics to optimize the appearance for the specific application.

Another major aspect of the external view is the ability of the user to direct the system to focus attention to certain aspects of plant operation. One example of this would be informing the system of aspects of planning so that the monitoring system can appropriately adjust its operation. This would occur, for example, if the operator knew of a scheduled shutdown of a part of the plant operation. The application will have the means of receiving this information and acting appropriately. Note that this type of action would have been "programmed" into the system during the application development phase. As implemented, it is only possible to specify this type of information by developing an external process (to the shell) that receives and sends blackboard data that specifies this type of information.

One final aspect of the external view is the presentation of conclusions and recommendations produced by the system. Since these are time-critical, appropriate methods of presentation will be used. Once again, the domain shell will provide a selection of presentation methods; it will be the task of the application developer to choose the appropriate presentation.

After the application has been created for a particular plant environment, the system is then installed with appropriate interfaces established. The system is then set into operation in the runtime environment. This will involve the blackboard framework in operation with the contributing knowledge sources.

To facilitate the creation of an application, the domain shell will provide a set of what could be considered programmer tools. Editors to create and modify the blackboard structures will be implemented. These editors will guide the user in the development phase by ensuring that the structures are viable. Compilers will translate the information entered by the developer into a form suitable for execution in real-time. Development diagnostic tools, will give the developer a means of checking the validity of his work before execution.

Because of the general nature of the domain shell, it is impossible to state the exact sequential nature of operation. This will be determined by the characteristics of the application as designed by its developer.

The internal view involves the description of the blackboard approach. This is the domain of the application developer, who must apply the tools in the domain shell to create the specific application. The internal structure is given in FIG. 3.

The blackboard structure contains data that is of relevance to one or more knowledge sources. Basically, it is a structure representing the state of the system. The developer creates a blackboard structure by organizing a hierarchy of information slots at different levels. Simply put, the highest level represents the broadest view of the plant, and each level beneath is a successively more detailed representation of a part of the plant. Note that the structure as created in the development environment must be augmented by actual and simulated data that is measured or derived during runtime.

The hierarchy of the blackboard is basically a partitioning of the understanding of the plant on different levels. For the plant environment, the partition that is most evident is the spatial and structural arrangement of equipment and processing areas in the factory itself. One can see the plant on a very abstract level, where raw materials enter a building at one end and finished products emerge at the other end. At lower levels, the processing can be seen to involve a series of steps or subprocesses, each of which can be represented on the blackboard. On the blackboard, parameters and variables of interest would be placed. These would be the parameters used by one or more of the knowledge sources.

The blackboard will hold this information. The domain shell will provide the blackboard structure components, and give the application developer the means of creating a blackboard framework specific to the plant. This framework will represent a model of the plant as the system understands it.

The knowledge sources are the particular segments which contain some form of reasoning about some part of the information in the model. Each knowledge source has its own domain, that is, the parts of the blackboard that it has knowledge about. A knowledge source interacts with the blackboard by initially recognizing that it "sees" something on the blackboard of interest. It then receives permission to alter some other section of the blackboard based on conclusions that it has reached. In this way, the state of the system (as seen on the blackboard) is updated and the overall system acts appropriately on the information in the blackboard. In the present application, however, the control process does the recognizing.

Each knowledge source in the blackboard system is responsible for recognizing the things that are important to it. In other words, each source should contain reasonable knowledge about its own domain of interest. In the domain shell, the application developer must have the information needed to integrate the knowledge sources into the system, and ensure that the knowledge source can interact with the blackboard. The knowledge source should provide the blackboard system with some indication of the urgency of its information.

The value of the blackboard approach is that different knowledge sources can apply their reasoning to overlapping parts of the blackboard. While the ability to overlap knowledge source domains introduces complexity, it is more valuable because it allows knowledge sources to fail without totally crippling the system. All major engineering systems provide for safety margins and backups, and the blackboard approach not only allows it but in effect encourages it by making sure that information is available to the knowledge sources that need it.

The simulator is a collection of mathematical and functional tools that can be used by the system. These tools include algebraic, difference and differential manipulations. These tools are not implemented as a distinct entity, although these tools do exist in parts of the domain shell.

The control is perhaps the most critical part of the blackboard approach. The control oversees the actual operation of the system. It is responsible for determining which knowledge source should access the blackboard, as well as prioritizing the operations of the knowledge sources. This portion of the blackboard structure will require the most thought, but will yield the most powerful performance if a well-designed control is developed.

A critical portion of the application development process will be determining an appropriate control hierarchy for the different knowledge sources. Even if the knowledge sources don't interact (their domains are mutually exclusive), the real-time nature of the domain shell requires that the system recognize the most urgent request first. For a complex application, different knowledge sources may have relevant information that could conflict. Thus, while the domain shell described here will provide a general set of tools for the application developer, it is vital that he develop a coherent problem solving strategy.

Because of the expected diversity of intended applications in the plant environment, the domain shell requires flexibility in knowledge representation, as well as the capability to adjust operation to the specific application. By use of the blackboard architecture, the desired flexibility is achieved while maintaining a foundation of standardized structure that can be the basis for expansion.

Overall System Design Description

This section describes the design of the shell at the operational level. It briefly discusses the system design concept and gives the modular decomposition of the shell. The system design is based on satisfying the requirements given elsewhere in this document.

A block diagram view of the the domain shell is shown in FIG. 4. The system is divided into the following modules: the blackboard, the event detector, the activation/agenda manager, the rule-based knowledge source, the case-based knowledge source, and the user interface. Each of these modules represents a distinct I/NIX process. Within the context of a specific application, there will exist one blackboard process, one event detector process, one activation/agenda manager process, and one user interface process. In addition, there must be at least one knowledge source process; multiple knowledge source processes are permitted.

Prior to the use of the shell, the user creates all the required input files. The required files are: the Blackboard Structure Description File (BSDF), one Rule-Base Description File (RBDF) for each rule base knowledge source, one Case Description File (CDF) for each case based knowledge source, and at least one Input Data File (IDF). The prototype software does not have editors; the app. developer creates these files outside of the shell.

In one embodiment, the shell will internally generate any description files.

While the shell checks the files for syntactical correctness, allowing the user to correct errors through a text editor, the shell does not scan the files for higher level errors or inconsistencies. Therefore, the user must ensure that the files contain consistent information or else the shell will generate unexpected results.

The shell is run by typing the program's name at the UNIX shell prompt, together with the system file name. The system (application) file name identifies a file that contains a list of files defining the structure of a particular application. The set of files determines the structure of the blackboard application; the BSDF and all RBDF's and CDF's related to the blackboard belong to the application. There is sufficient flexibility here to permit, for example, the creation of similar applications with perhaps one knowledge source removed. This allows the evaluation of the usefulness of a particular knowledge source to the application being tested.

After the system file has been given to the shell, the shell then begins loading the information. The shell starts the appropriate processes and supplies them with the name(s) of the appropriate file(s). This would include the blackboard process, the event detector process, the activation/agenda manager process, and the rule-based and case-based knowledge source processes. After all of the input files have been loaded, the shell is ready to initiate a session run of the application. In one embodiment, it asks the user to set the run parameters and specify the Input Data File (IDF). In another embodiment, IDF's are not used in the run-time environment. At this point the session run begins.

A session run of an application consists of the shell receiving input data and taking appropriate action based on the data. The determination of appropriate action is the responsibility of the event detector process. Data values are updated on the blackboard and test conditions are evaluated to determine whether a knowledge source should be fired. If a knowledge source should be fired, then its name is placed on a First-In-First-Out (FIFO) queue to await execution. The present invention uses more sophisticated control including interruptibility.

The activation/agenda manager controls the execution sequence of the knowledge sources. It ensures that only one knowledge source is executed at a time.

Each knowledge source process used by the application contains appropriate structures relevant to its domain of expertise. During the shell's operation, each knowledge source pauses until activated by the activation/agenda manager. Upon awakening, the knowledge source executes its routines in an attempt to generate a diagnosis. When a knowledge source makes a diagnosis, it is written into a diagnostics file.

As a knowledge source executes, it requests data from the blackboard directly. Thus, all knowledge sources have direct read privileges with the blackboard. However, data updates to the blackboard generated by a knowledge source are directed through the event detector. The event detector can then scan the data to determine if an event has occurred.

The design decision to direct data updates through the event detector is an important one. The alternative is to allow each knowledge source to write directly to the blackboard. The advantage of direct writing is the efficiency of writing to the blackboard. The disadvantage is that the event detector must then continuously search the blackboard to determine if updated data is present. The shell's design, with indirect data updates from the knowledge sources, makes uniform all updates to the blackboard, whether from sensors or from knowledge sources. Conceptually, this is a simplification for the event detector, which has other difficult tasks to perform. If the event detector had to search the blackboard continuously, it would represent a fundamental conceptual shift in the blackboard operation from an asynchronous, data-driven process (as originally envisioned) to a mixed combination of asynchronous processes and systematic searches.

The sequence of reading input data, firing knowledge sources and generating diagnoses continues until the user specifies to the shell to stop only for prototype. At this point, an ordered list of the diagnoses, the Diagnostics File (DF), is generated.

Description of Processes

This section describes in more detail each of the processes involved in the execution of the shell. Each process is described in terms of four entities: a brief summary of its purpose, the process name, data structures, and the logical flow of the program. The data structures and logical flow entities are augmented by programming guidelines wherever necessary. The input/output relationships are described hereinafter. It should be noted that the level of detail in this section is such as to guarantee proper operation of the overall software. Thus, programmers are constrained by the information contained here. For example, the data structures described in subsequent sections are implemented as described here; programmers are free to use any other structures that also might be required for the proper operation of a module.

The Blackboard

The blackboard process incorporates the blackboard objects and the methods necessary to manipulate the objects. Process name: blackboard Data structures: FIG. 5 shows the basic organization of the data structures which represent the blackboard objects. The structure on the left is an array which implements a hash table. On the right, linked lists store the attribute/value pairs.

Programming guidelines:

The hash table is implemented using Brent's variation of the open addressing with double hashing algorithm. The size of the hash table starts out at a large number, but not excessive. For example, 503. If the number of objects causes the table loading factor to exceed approximately 85%, a new, larger table is allocated, and the data is rehashed. The maximum hash table size is 43,391 or larger.

The hash table key is the object name, and the table entry is a pointer to an object structure, which also contains the name of the object (pointer to a string). Upon retrieval, the key and the name string are always compared. Accessing an object/attribute is also possible by using the index of the object in the hash array, and the index of the attribute in the list. This provides a fast access mechanism during runtime, if such indices are known by the entities requesting the access.

Attribute structures include a demon slot, optionally referencing a function. If present, the function is executed each time the attribute receives new value(s).

Value structures contain a "type" slot. FIG. 6 shows the type codes.

Value structures contain a "time stamp" slot, in seconds. Insertion in the list is such that most recent values are first.

Insertion in the value list is done such that there is always one, and only one value older than current the time stamp minus the history length. All other, older values are discarded.

Logic flow:

The blackboard manager performs several functions. First, after the process is started, it creates the blackboard structures from information contained in the file whose name is passed on to it. Then, it receives messages which request getting or putting data on the blackboard. Each message is acknowledged by one of the following: a data message, if a successful "get" took place, an ACK message, if a successful "put" took place, or a NACK message, if an error is found. A STOP message from the user interface tells the software to write out the blackboard structures and exit. A RESET message causes the blackboard to clear all its data contents, but not its structure of objects/attributes. This module can be written in a structured programming language such as ANSI C.

The Event Detector

This process receives data from external sources. It also receives the data that knowledge sources want to write on the blackboard. All incoming data is sent to the blackboard process. Every piece of incoming data is also checked for potential detection of an event. An event may be triggered by the value of data, i.e., by satisfying an expression, or by the simple arrival of a data point, regardless of its value. Timer based events are handled by the activation/agenda manager process. A list of knowledge sources associated with detected events is sent to the activation/agenda manager process.

Process name: event detector On the left, an array implements a hash table. Each data source, be it sensor (external) data, or knowledge source generated, has an entry in the hash table, which points to a data point structure. Each data point then has an associated indirect expression list. The elements of this list point to entries in the expression list, which in turn, has pointers to the expression arrays.

Programming guidelines:

The hash table is implemented using a simple, double hashing algorithm. Since the event detector is a potential bottle neck, the highest possible performance should be sought.

The size of the hash table is expected to be smaller than the blackboard table. It also starts at 503, and more space is allocated if the loading factor exceeds 90%.

The hash table key is the concatenation of the object and attribute names. The table entries point to data structures which also contain the object/attribute names. The names are always compared during retrieval.

Logic flow: FIG. 8 shows a simplified representation of the program's logic. The initialize part is executed when the process is started: it creates the structures shown in FIG. 7, by loading and parsing the event expression definitions from the knowledge source description files whose names are passed to it as arguments. The remainder of the program is driven by the receiving of messages.

Programming guidelines:

All incoming data messages are acknowledged by a NACK message if a syntax error is found, or by forwarding the blackboard acknowledgment message back to the original sender otherwise.

An expression evaluator is described herein. Event defining expressions are similar to evidence expressions, hence the same software is used.

The operators used in expressions are essentially the same as operators used elsewhere in the system. Thus, in order to differentiate between newly arrived values, and older values, available from the blackboard, the new operator is required to precede object/attributes which trigger on arrival of new data.

If there are no expressions associated with a knowledge source, such knowledge source will only fire if one of its preconditions include the every operator. This module can be written in C++, since it has object-oriented features.

The Activation/Agenda Manager

This process starts the execution of a knowledge source. The knowledge sources activated by the event detector are started immediately, if and only if their preconditions evaluate to TRUE. If no preconditions are defined for a knowledge source, it will fire at the next opportunity. A priority scheme determines execution order. A separate queue is kept for knowledge sources that execute periodically.

Process name: a manager process: (a priority scheme for activation of event driven knowledge sources), a time-based queue for periodic knowledge sources, and a knowledge source/precondition expression structure for checking preconditions. The latter is conceptually identical to the event detector data structures, as shown in FIG. 7, with the following differences: a hash table is not required at this time, a simple array of size 100 will suffice; an expression list for each knowledge source is pointed to by the array elements; hence, the object/attribute structures and the indirect expression lists are not needed; the "knowledge source" and "updated" slots in the expression list structures are also not needed. implements the activation/agenda manager is best thought of as two interrupt driven programs. One reacts to the arrival of a message from the event detector, as shown at the top of FIG. 9. The other reacts to the passing of time, as shown at the bottom of FIG. 9. driven programs, the actual implementation approach is at the implementer's discretion. This module can be written in C++.

Rule Based Knowledge Sources

This process implements a basic data-driven (forward chaining) inference mechanism operating on a set of IF . . . THEN . . . rules, with propagation of belief. rule network (tree). An example is shown in FIG. 10. The network nodes exist in three fundamental layers: the input layer, consisting of data nodes, the intermediate layer, consisting of hypothesis, variable and constant nodes, and the output layer, consisting of malfunction nodes. Their structures are shown in FIG. 11. The data and malfunction nodes must have blackboard equivalents. The other node types (hypotheses, variables and constants) may, but are not required to. The supporting- and supported-rules slots contain pointers to structures which describe the way nodes are inter-related. These structures are the rules, and their basic organization is shown in FIG. 12. Also shown in this figure is the structure of meta-rules.

In addition to these structures, FIG. 13 shows the organization of several other entities which are required for the implementation of the features described in the functional specification, Some of these are further discussed. Lastly, a structure is needed to store evidence expressions.

Logic flow: The program first reads the rule base description file and creates the structures described above. Then, it waits for a message. If it is a SETPARAM type message, then the program sets or resets the trace, log and step run parameter, or it changes the value of the global sufficiency and necessity factors, or it changes the values of the global alpha and beta cutoffs. For setting breakpoints, the rule based knowledge source's own user interface is invoked. If the message is a RESET type message, then the program resets itself, in preparation for a new session run. If the message is an ACTIV type message, the program generally follows the steps shown in FIG. 14. The logical flow shown in this figure is greatly simplified. Critical aspects of the software are further elaborated in the following sections.

Evidence Expressions

As shown in FIG. 14, before a rule can fire, certain conditions must be met: be within the range defined by the alpha and beta cutoff values.

These conditions are dependent on expression evaluation. The general strategy for handling expressions is as follows. An expression is initially specified in a rule base description file using a prefix or infix notation. A few examples: hypothesis #2 is TRUE

The text is stored as a string in the evidence-text slot of the rule, for simple display purposes. It is also parsed into an expression-array. The structure of this array is a strict prefix, recursive representation of the expression, where the operators have been replaced by their corresponding tokens (or pointers to functions), and the operands are replaced with pointers to the structures holding the dynamic values, or with the values themselves, if they are static constants.

In the last example, the numbers 2 and 3 indicate the number of operands following the token. A pointer to this array is placed in the evidence-expression slot of the rule. The parser also generates a separate evidence-list containing only the operands which are pointers. This list is used for quick checking of the availability of the evidence.

Runtime evaluation of the expression then consists of recursively calling a simple evaluation function which performs the actual calculation.

The conditions for firing a rule are then checked as follows: to 1), updated. If yes, CF evidence. This value, combined with the rule's sufficiency or necessity (as described in the next section) determine the rule's contribution to the belief in the rule's hypothesis. If the contribution affects the hypothesis MB, and the contribution amount (value) is greater than the alpha cutoff value, OR if it affects the hypothesis MD, and the contribution amount is less than the beta cutoff value, then the rule can fire.

Operands can be of several types:

Value operands evaluate to a number. Value operands can be specified by an actual number, the name of a node, the name of a context, or an expression which itself evaluates to a value. If a name is used, then the value used in calculations depends on the type of structure: their value slot.

CF operands are like value operands, except that the value must be a number between -1.0 and +1.0.

Piece-wise-linear operands are the name of a piece-wise-linear structure, which supplies a list of X-Y pairs for data interpolation.

Operators are also of various types:

Algebraic operators always return numerical values, and all of their arguments are values. A list of these operators is given elsewhere. In addition a current.sub.-- time operator is provided, which returns the time stamp of the current set of data.

Boolean operators always return a CF value. Their operand types however differ: where the weight is a number. an optional piece-wise-linear. If the latter is not specified, the operators return +1 or -1 (TRUE or FALSE). Otherwise, a fuzzy result is calculated by mapping the difference of the two numeric arguments on the x-axis of the piece-wise linear function, and returning the corresponding y-axis value.

Time-based operators always return a numerical value. Their operands are a node name and a value (delta T). The second argument must be an actual numerical value. A list of time based operators is given elsewhere. In addition, two more operators are added: a time value operator, which returns a value from the node's history, and a time stamp operator, which returns the time stamp of a data node (not necessarily the same as current time).

Change-based operators always return a value. The time when operator requires one expression as an argument. When the truth value of the expression goes from FALSE (less than zero) to TRUE (positive value), the time of the transition is recorded. Hence, the expression should be a CF type. The value when operator takes two arguments: a CF expression and a node name. When the expression goes from FALSE to TRUE, the value of the node is remembered. Both of these operators accept an additional argument, used to define the transition from FALSE to TRUE. If this optional argument is missing, the boundary between TRUE and FALSE is the global alpha cutoff value.

Other notes:

When expressions are used as a rule's evidence, they must evaluate to a CF type. In other words, the top level operators must be of boolean type. In all other circumstances (such as meta-rules and calculations stored in variable nodes) there are no restrictions.

All node references in expressions which include time based operators must have corresponding object/attribute entities in the blackboard, where the actual histories are kept. When the reference is in a rule's evidence, then the name of the node should be used; when it is in an event or precondition definition, the object/attribute names have to be used.

Only one change-based operator is allowed per rule.

All time references are in seconds. All time intervals are measured from the current time stamp (not necessarily the same as the current real time).

Some operators have "aliases": add +; and &; diff -; div /; equal =; greater >; less <; not !; or ? ; and times *. These operators can be used (either their names, or their aliases) in both infix or prefix notation. All other operators can be used in prefix notation only.

The number of arguments is generally implied by the nature of the operator. Some operators however can take any number of operands: and, or, average, diff, div, max, min, std-dev and times.

Inference Mechanism

Propagation of belief. This is done in three steps: section. Also, see elsewhere, for combining formulas of boolean evidence. confidence levels, named sufficiency and necessity (SF and NF). The table in FIG. 15 gives the complete algorithm. Note: this contribution is used in the determination of the alpha-beta cutoff. hypothesis, the union probability rule is used:

Beliefrule-i, where Beliefi is the hypothesis' MB or MD, as indicated in FIG. 15, and Beliefrule-i is the contribution of the with rule, as indicated in FIG. 15.

Data nodes. The input into the system is in the value slot of the data nodes. These values are generally converted to beliefs by use of comparative booleans.

Meta-rules. These rules do not propagate belief, but are used to change the context and to modify the importance of rules. The target-list slot of a meta-rule (see FIG. 12) therefore points to context or rule structures. In the first case, the target-slot slot of the meta-rule is assumed to be the value slot of the context structure; in the second case, the SF or NF slots of the target rule must be specified. The source slot of a meta rule contains an expression. The value obtained by its evaluation is passed on as an argument to the optional function slot (a piece-wise-linear function), and the result is placed in the target-slot of the target contexts or rules. If a function slot is not defined, then the result of evaluating the expression is placed directly in the destination (target-slot).

When a meta-rule changes the context, all the rules that have already fired, and whose context changed, are "unfired" (i.e., their effects are removed). The program then re-checks rules that couldn't fire before the context change, for the possibility that they are in context now. Similarly, when a meta-rule changes the SF or NF of a rule, all effects of this rule must be undone, and the rule fired again.

Two observations about meta-rules: first, they can cause infinite loops, due to the un-firing and re-firing process. Thus, each meta-rule has an optional associated counter, which only allows a predefined number of executions of the meta-rule. If a counter is not defined, it is assumed to be 1. Second observation: meta-rules must be used with caution, since they not only are difficult to use conceptually, but they also greatly reduce runtime performance.

Evaluators. Although similar to rules, the purpose of the evaluators is not to propagate belief, but rather to perform calculations. Thus, an evaluator structure (FIG. 13), has a context expression, just like a rule. It's expression slot is evaluated, just like a rule's evidence. The result of this evaluation is then placed in the value slot of the variable whose name is in the variable slot. Debugging. Eight run parameters can be set: on the screen by each rule, when it fires. ".log" only when requested by the user after the marked rule fired global SF and NF: they define default values for these two parameters (i.e., if a rule is defined without an SF and/or NF value, then the global defaults are used.) (i.e., if a rule is defined without an ALPHA and/or BETA value, then the global defaults are used.) The global ALPHA is also used to define the default transition from FALSE to TRUE for change-based operators, if not specified within the expression.

All these parameters, except for breakpoints, can be set and cleared by SETPARAM messages from the user interface. The breakpoints are set by the rule-based knowledge source software, via its own user interface: circumstances: when the user wants to set breakpoints, and during runtime, if the step parameter is set, or a breakpoint is encountered. The program's user interface allows the user to perform a minimum amount of browsing through the rule base (e.g., list structures). The system structure shown in FIG. 13 stores the appropriate bookkeeping information for this purpose. the top malfunctions are listed. This output file has the extension ".out"

Put value in bb. This action takes one argument, a node name. If the rule having this action fires, the value of the node argument will be sent to the blackboard. Note that a malfunction's value is sent to the blackboard automatically.

Assign. This action takes two arguments, first a variable name, second, a node name. The value of the second argument is placed in the value slot of the variable node.

Show. This action takes no arguments. When the rule fires, information similar to that displayed by the trace parameter is shown on the screen. This action is useful if a rule needs to be monitored, but without stopping the run (as a breakpoint would do), and without displaying information about other parts of the rule base.

Performance. The program will record its starting and stopping times, as well as the number of rules fired and unfired. Blackboard access times are also recorded. This module can be written in C++.

Case Based Knowledge Sources

This process calculates a similarity value for each case stored in its case tables, by comparing each case with the current data.

Process name: case based case table. The case-based process represents the data in the table in two separate structures, as shown in FIG. 16: a static data array, and a dynamic data array, for the time-dependent data. The static data array is simply an array of floating point numbers (doubles). The dynamic data array is an array of pointers, where each cell points to a history array. Each cell of the history array, in turn, contains a value/time pair. In addition to the data arrays, two other structures are needed, to store the function/weight information. One such structure corresponds to the static data array, and it is itself an array of function/weight pairs. The other structure corresponds to the dynamic data array, and it consists of weight/pointer pairs. The weights are used for the result of matching the time dependent data; the pointers point to another array, which consists of function/weight pairs. In addition to these structure, a summary array is used to keep the final score of each case, together with the name and attribute of the blackboard object to which the case corresponds, and a description of the case. are initialized (loaded) from a case description file. Then, whenever the process is activated, the current data is compared to the data in the structures, and scored according to formulas.

Programming guidelines:

There are four functions f used for scoring: equal, less than, greater than and match-points-on-curve. The latter function translates into equals and weights of 1 in the function/weight array. Since all values are floating point numbers (doubles), the equal function is defined to be TRUE whenever the two values are within some small percentage of each other (e.g., 1%). This is true in all similar cases.

The results of applying the functions range from 0 to 1. Interpolation is performed between user defined points.

Aside from all of the above, a criterion is needed for when to place a similarity score back on the blackboard. For example, whenever the score is greater than a predefined percentage of the maximum possible score for a case. The maximum score would then be calculated once, and stored in the summary array. In this implementation, the scores are always written back into the blackboard.

An output file is written at the end of each activation session, as described elsewhere.

The User Interface

This module generally performs two functions essential to the operation of the software. It is the principal means by which the user interacts with the system. It also acts as a "supplier" of data during the execution of the diagnostics.

Process name: user int to store the input data. This linked list is created from the contents of one data file, and it is used to supply the data to the event detector at the appropriate times, as determined by the time tags. Note that, at this time, the data values are of one type only (double); other data types may have to be added in the future. The use of this structure is optional. this program. There are three parts to this process.

First, the names of files in which the descriptions of the blackboard and of the knowledge sources are determined. The names of these files are kept in a system file, which has the name <system name>.SYS. The name of this file can be passed as an argument to the program:

Next, the other processes are started. First, the blackboard process, then the control processes (event detector and activation/agenda manager), followed by the knowledge sources.

After the system has been loaded, the actual execution of the diagnostics is started. First the user has the option to set run parameters: tracing, logging, stepping and breakpoints can be set or turned off; SF's, NF's, alpha and beta values can be set. Then the user is asked for the name of a data file. At this point the user may, in general, specify a time scale factor, which is used to "compress" or "expand" the time scale, such that data sets are run faster or'slower than real time. The data sets are then supplied to the event detector, one at a time, until there are no more sets. The setting of the run parameters and and the execution of the diagnostics is then repeated as long as the user wants to.

Programming guidelines:

After starting a process, the user interface waits until the process acknowledges the correct loading of its file(s). If an error occurs, a NACK message is expected. This message includes an error message, which is displayed. In this case, the user has the option to repeat loading the file with the error, after it is fixed in a different UNIX shell.

The displaying of error messages due to syntax problems in files is the responsibility of both the loading process and of the user interface. The setting of the trace, log and step run parameters is done from the user interface, via messages to the knowledge source(s). The setting of breakpoints however, requires passing control over to a rule-based knowledge source.

Before asking the user for a time compression factor, the program may display the time required to run the diagnostics in real time, based on the difference between the last and the first time stamps in the data file. The time compression must be done such that the data sets do not become overlapping as the interval between them becomes smaller than the available time resolution.

Interface Description

This section provides the details of the interfaces between the modules. It also contains message format descriptions and file syntax structure for the shell's input and output files.

FIG. 19 is a detailed picture of the system block diagram. It shows the socket connections, the message paths, and the I/O files (Section 4.3) that are required for the shell. The man-machine interface and its connections are not shown in FIG. 19. However, its interface requirements are described in this section. Message queues are also used for communications. Message queues are a standard feature of the UNIX operating system on HP computers. The manner of usage is similar to that for sockets; in other words, the description given here for communications applies also to message queues.

Communications

Interprocess communication between modules in the shell is based on either the use of Berkeley Interprocess Communication (BSD IPC) Sockets or UNIX message queues. Either of these modes provides a means of message passing so that data can be transferred between two processes.

The socket mechanism provides a related series of operations through Internet domain sockets. Compatibility between the two domains exists on a function to function basis.

For socket communications, the shell uses stream sockets since these provide reliable, two-way communication. Communication through the channel is analogous to that for UNIX pipes (file streams). The shell uses the sockets to exchange messages in a message sequence. The message sequence is essentially a request-response pair. The initiating process requests an action; the receiver then responds with either the results of the action, an acknowledgment of success, or a notification of failure.

Throughout this section it is assumed that the request messages are free from errors. However, processes will respond to an error in a message with a notification of failure (NACK) message if they are able to detect the error before a response is needed.

For the shell, all required communication channels are established before a session run begins. When the shell is started, each of the six process types described elsewhere is started (user interface, blackboard, event detector, activation/agenda manager, prototype only, and rule based knowledge source and/or case based knowledge source). A sequence of communication establishment then begins.

For socket communications, in its initialization, the user interface process establishes a bound socket with a listen queue. When the event detector, blackboard, activation/agenda manager and processes are started, they each request a connection with the user interface. Three channels are established in this manner. The blackboard, event detector and activation/agenda manager each establish their own bound sockets with a listen queue. Four additional socket channels are established: the event detector--blackboard channel, the event detector--activation/agenda manager channel, the activation/agenda manager--blackboard channel, and the blackboard--man-machine interface channel. Additional channels are established as the application's knowledge sources are spawned from the parent knowledge source process. For each knowledge source, communications are established with the event detector, the blackboard and the activation/agenda manager.

There are two distinct uses of the connections within the shell. The first use is data-oriented, being involved in requesting and supplying application data for transfer between modules. The second use is control-oriented. This entails the activation of processes and changes in the modes of process operation. However, the type of communication established is independent of the use. Activities of either type of use are permitted. The content of the message determines the usage. The distinction is made in this document to efficiently categorize the design information presented herein. Only one communications channel normally uses both data-oriented and control-oriented message sequences. This is the event detector-user interface channel. The data-related communication channels carry five distinct message types. They are shown in FIG. 20. The syntactical format of the message streams corresponding to these five message types are described hereinafter.

A further distinction of the DATASUP message type is possible between data headed for the blackboard and data coming from the blackboard. This distinction can be made on contextual information (i.e. which process is sending the data). However, it is not necessary to have a distinct message format specified, since the content of the message is similar for both DATASUP messages. This socket channel is established as part of the initialization of the shell processes prior to a session run.

One task of the user interface is to supply the data input to the event detector. Data is supplied to the domain shell either from an input data file, used to simulate "real" data, or a UNIX process external to the shell that sends "real" data. The event detector responds to the message in one of two ways. If a syntax error is found, then the event detector returns a NACK message. Otherwise, the event detector relays the DATASUP message to the blackboard. This channel also carries control-oriented messages. These messages are discussed herein.

The event detector agenda/activation manager channel is established when the event detector and agenda/activation manager are initializing. The connection must be established prior to the beginning of the application session run (when the input data is read).

The channel is used to deliver the list of knowledge sources to be activated from the event detector to the activation/agenda manager. The event detector passes a KSSUP message that contains the list of knowledge sources. The agenda/activation manager responds with an ACK message to indicate that a correct message was received. The event detector blackboard socket channel is established when the event detector and the blackboard are initializing. The connection must be established prior to the beginning of the application session run.

The channel delivers the data updates to the blackboard, and also provides a two-way channel for the event detector to request data from the blackboard, and the blackboard to deliver the data. There are two message sequences that pass through this channel. One message sequence is the event detector furnishing data to be updated on the blackboard with a DATASUP message. The blackboard will acknowledge receipt of a correct DATASUP message with an ACK. The other message sequence is that of the event detector requesting data from the blackboard with a DATAREQ, and the blackboard supplying the data with a DATASUP.

The activation/agenda manager blackboard channel functions in an identical manner to the event detector--blackboard connection, except that there is only one message sequence. This is the DATAREQ-DATASUP sequence as described in the previous section. The implementation requirements for this channel are identical to those for the event detector--blackboard. See the previous section for details.

One channel is established for each knowledge source in the application. At this point, the required number of knowledge source processes is known by the shell. When each spawned knowledge source process is being initialized, it requests a connection with the blackboard.

One message sequence type is used on the knowledge source--blackboard channel. This is the DATAREQ-DATASUP sequence as described for the event detector--blackboard channel. Here, the knowledge source is the requester of the data, and the blackboard is the supplier of the data.

Each knowledge source has a connection with the event detector. The connection is established when the knowledge source is being initialized.

The message sequence on this channel is the DATASUP--ACK sequence as described for the event detector--user interface channel. The event detector responds to the DATASUP message from the knowledge source by sending an ACK message to the data-supplying knowledge source.

The shell uses a process starter that is responsible for starting and terminating the other shell processes.

There are six control-oriented message types. They are shown is FIG. 21.

The syntactical formats of the message streams corresponding to these message types are described herein.

The event detector process starter channel is established during the initialization of the shell processes prior to an application session run.

The process starter is responsible for controlling the event detector process. The process starter sends an appropriate control message to the event detector. The event detector responds with an ACK message if the message is correct.

The process starter a/a manager channel is established during the initialization of the shell processes prior to an application session run.

As in the previous section, the process starter a/a manager channel is used by the user interface to communicate appropriate control messages to the activation/agenda manager.

The process starter blackboard socket channel is established during the initialization of the shell processes prior to an application session run.

Again, this channel is used by the user interface for controlling the blackboard as described for the user interface--event detector channel.

The process starter knowledge source channel is established when the knowledge source is initializing after it has been spawned.

The process starter must be able to shut down a knowledge source process when desired with a STOP message. This is one use of the channel. Another use is when the user desires to set operating parameters for a knowledge source. The user interface then sends a SETPARAM message to the knowledge source, communicating the desired operating mode.

The a/a manager knowledge source channel is established when the knowledge source is initializing after it has been spawned.

The purpose of this channel is to allow the activation/agenda manager to activate a knowledge source when it is time for that knowledge source to begin reasoning. It sends an ACTIV message to the appropriate knowledge source to inform it that it should begin active operation to produce a diagnosis.

A control message is also sent from the knowledge source to the activation/agenda manager when the knowledge source has completed executing. This allows the agenda manager to update the status record for the knowledge source.

Messages

There are nine distinct messages that pass through the communication paths. All messages are headed by an integer code, which identifies the type of message that follows. FIG. 22 shows a typical integer code for each message. Actual implementation codes include additional information to source and destination process.

The whitespace characters shown in the figures for the message formats are present for clarity. The actual data message formats include the size of the message and should also be efficiently aligned.

DATAREQ

This message contains a sequence of object attributes whose values are requested. FIG. 23 shows the message format. The message begins with the DATAREQ identifier, followed by the number of objects whose attribute data is requested. Each object name and attribute name is then listed.

DATASUP

This message contains a sequence of object attributes with values and time stamps for the attributes. FIG. 24 shows the message format. The format is similar to that of the DATAREQ message except that the attribute values and times are also present.

KSSUP

This message contains a sequence of knowledge source identifiers to be activated. It is headed by the KSSUP identifier. FIG. 25 shows the message format. The message is headed with the KSSUP identifier, followed by a sequence of knowledge source identifiers. The knowledge source identifier is a unique handle for the application, determined by the order of appearance of the knowledge source file name in the the system file. Note that UNIX process numbers are not recommended as handles.

ACK

This message consists solely of ACK identifier code returned to the communication initiating process.

NACK

This message consists of an integer NACK identifier code.

START

This message consists of a START identifier, followed by a character string. The character string provides the means of passing information to another process. If the processing sending the string is ready to start, then it sends the strink "OK" to the user interface. Otherwise, it should send an error message, to be displayed by the user interface.

STOP

This message consists of a STOP identifier.

ACTIV

This message consists of a ACTIV identifier.

SETPARAM

This message consists of a SETPARAM identifier, followed by a list of arguments (character string). The arguments will specify to the receiving process what particular parameter setting action to take. FIG. 23 shows the structure of the message. There are six types of parameter codes. They are: trace, log, step, breakpoint, alpha/beta and sf/nf. Trace, log and step are followed in the message with a status code. Alpha/beta and sf/nf are followed by two numbers representing floats that are the first and second parameter values. Breakpoint requires the user to interact with the receiving process to set breakpoints.

Input/Output Files

All files used by the shell are identified by type by the use of a particular suffix. The filename is filename.suffix, where filename is a descriptive name supplied by the application developer, and suffix identifies the file type. Suffix identifiers are specified in the appropriate sections below. In general, suffixes can be in lower or upper case.

Input files are created outside of the shell, then supplied to the shell through specification of a system file.

The application development editors automatically create these files; the developer need not edit them outside the shell, and in fact may compromise the application if this is done.

The following conventions are used in the figures showing the syntax of input files in this section. Upright text (such as FUNCTION:) must appear exactly as shown. Italic text (such as object.sub.-- name.sub.-- 1) denotes information that the user must supply. Text in the current text font (Helvetica) is explanatory information and does not appear in the actual file. Elements of a file that are optional are enclosed in < >. Generally, the order in which elements appear in files is important, and must be the same as shown here.

All whitespace characters (spaces, tabs, end-of-lines) can be expanded for clarity. Separation of entry elements by end-of-lines is recommended to make the file more readable. Comments can be inserted at any point in the file using the // comment-to-end-of-line format from the C++ language. Lastly, all references to timestamps require the following syntax:

This file, identified as filename.sys, contains a list of file names. The file names identify the Blackboard Structure Description File (BSDF), and all knowledge source files, both Rule Based Definition Files (RBDF) and Case Description Files (CDF) for a particular application. For knowledge source files, the form of display can also be defined here. If the file name is followed by ",NORMAL", then the knowledge source is allocated a standard size window. If the NORMAL switch is omitted, or if the ICON switch is used, then the knowledge source is only allocated an icon in the upper left corner of the scren. FIG. 27 shows the syntax of the file. Note that all normal UNIX rules for the use of pathnames in file specifications apply. A valid system file must include exactly one BB file first, followed by a minimum of one knowledge source file. All rule based knowledge source file names must precede case based file names.

Blackboard Structure Description File

The Blackboard Structure Description File (BSDF) contains the information necessary to create internal structures used by the blackboard process. The information in the BSDF maps directly into the blackboard structures described herein. A BSDF is identified as filename.bb. The syntax of the BSDF is shown in FIG. 28.

Every object in the blackboard has a separate entry in the BSDF. For every object, all attributes of the object are identified by name. Each object must have a unique name. Attribute names are repeated as necessary. Choices for value types are shown in FIG. 6.

A valid BB file must include a minimum of one object, with a minimum of one attribute.

Rule Base Description File

The Rule Based Definition File (RBDF) contains the information necessary to set up a rule based knowledge source. The data in the RBDF maps directly into the rule base structures described herein. A RBDF is identified as filename.rb. The syntax is shown in FIG. 29.

There are three parts to an RBDF. The EVENTS portion of the RBDF is a list of expressions that are used by the event detector to determine if incoming data constitutes an event relevant to the rule base. The PRECONDITIONS portion of the RBDF is also an expression list, which is used by the activation/agenda manager to further determine if a knowledge source should be activated. For the EVENTS and PRECONDITIONS list of expressions, it is understood that the list is "OR"ed. That is, any of the expressions evaluating to true will indicate to the appropriate process (event detector or activation/agenda manager) that certain conditions have been satisfied. If there are no event expressions, then that knowledge source will execute only if the precondition part includes an every operator. If there are no precondition expressions, then the knowledge source will be activated whenever one of its events is true. The "EXPRESSION:" prefix must be followed by an expression (i.e., it must not be present unless an expression is present.)

The RULE BASE STRUCTURES portion of the RBDF contains the structural information needed by the rule based knowledge source process. The process starter provides the RBDF name to each of these three processes (i.e, event detector, activation/agenda manager and rule based knowledge source); it is their-responsibility to extract the necessary information. Each section of the RBDF is separated by a string of `*` characters.

The evaluation expressions used for the EVENTS and PRECONDITIONS, as well as the expressions used in the RULE BASE STRUCTURE part of the RBDF are further discussed herein.

Other comments: meta-rules and evaluators must be defined first in the earlier parts of the RULE BASE STRUCTURE of the file. the parsing software as separators between sections of the file. loaded, at least one context must be TRUE; meta-rules can change this during execution.) node, one rule, and one context.

Case Description File

The Case Description File (CDF) contains the information necessary to set up a case based knowledge source. The data in the CDF maps directly into the case table structure described herein. A CDF is identified as filename.cb. The syntax is shown in FIG. 30.

The division of the CDF into three portions is similar to that for the RBDF. The EVENTS and PRECONDITIONS portions are identical to those for the RBDF. The CASE BASE STRUCTURE portion provides the structures necessary to set up a case table.

The CASE BASE STRUCTURE consists of two parts:

First, functions (equal, greater and less) are defined. Each function is defined in terms of two margins, expressed in percentage points. They work as follows. of each other, then the score is 1.0; if two numbers are more than (equal.sub.-- high.sub.-- margin) % different, then the score is 0.0; otherwise, a linear interpolation is performed between the two margins. history value by more than (greater.sub.-- high margin) %, then the score is 1.0; if the current number is less than the case history value by more than (greater.sub.-- low.sub.-- margin) %, then the score is 0.0; otherwise, a linear interpolation is performed betwen the two margins. history value by more than (less.sub.-- high margin) %, then the score is 1.0; if the current number is greater than the case history value by more than (less low margin) %, then the score is 0.0; otherwise, a linear interpolation is performed betwen the two margins.

Second, the cases themselves are defined. Each case must be given a name. Each case in the case table must map into an object attribute in the blackboard. For each case, a set of object attributes is then specified, along with values and weights. The values are given as value, time pairs. Each pair is followed by an optional function name (FEQ, FGT, FLT) and weight. If the latter are omitted, FEQ and W1.0 (weight of 1) are assumed. The match-points-on-curve function, as defined herein, is thus invoked by omitting the function names and weights.

A valid case based knowledge source must have a minimum of one case point.

Input Data File

The Input Data File (IDF) contains the sets of data simulating incoming data to the system. The user interface process reads this file and supplies the data to the event detector process. An IDF is identified as filename.dat. The syntax is shown in FIG. 31.

Output Files

Output files are generated by the shell in the course of its operation.

"LOG" Files

LOG files are generated by rule based knowledge sources whose log flag has been turned on.

The information in these files provides a relatively detailed trace through the execution of a rule base.

"OUT" Files

Each knowledge source that generates diagnostics writes to an OUT file. Each entry in OUT files generated by a rule based knowledge source represents a diagnostic message, with associated priority and severity measures. Each entry in OUT files generated by a case based knowledge source includes the calculated scores for its cases.

Additional information may be included in these files.

"DIA" File

The Diagnostics File (DIAF) contains the results of a session run. It is a list of the diagnoses and case matches that the shell has made during the just-completed session run. The diagnoses are the ordered combination of the diagnoses made by the individual rule based knowledge sources, followed by the ordered combination of case matches found by the individual case based knowledge sources. Basically, the results existing in the OUT files are merged and sorted by time.

Blackboard Status File

The Blackboard Status File (BSF) is similar to the BSDF in that it contains the structural information necessary to recreate the blackboard. It also contains a snapshot of all of the data values stored in the blackboard. Using the BSF file, the blackboard can be restored on a subsequent session run. Because of its compatibility with the BSDF, it also is identified as filename. BB. The syntax is the same as the BSDF.

User Interaction

All user interaction with the shell occurs through the user interface. The nominal sequence of interaction with the shell is described herein. Details for the user interface are described elsewhere in this document.

The domain shell program is designed for operation on the Hewlett-Packard 9000, Series 700 family of workstations. The workstation should run the HP-UX operating system, Version 8.05 or higher. The HP-VUE visual user environment should also be present. This environment is layered over a Motif-based X-window system. The domain shell uses xterm windows within this framework.

In order to use the shell, users must create input files to be used by the system. Therefore, it is helpful to be familiar with the shell's overall design concept as well as the individual input files' syntax and structure. Other sections herein contain the overall system design description and describe the operation of the components of the domain shell.

The creation of input files must be done prior to the operation of the shell. In order to use the shell, the following files must be created: system file, blackboard structure description file, one rule base description file for each rule base, one case description file for each case base, and at least one input data file. The uses of these files are described herein. The location of these files is not restricted; however, if they are not located in the same directory as the shell executable files then the full pathname of the file must be given in the system file.

The application development environment in the Version I software manages the naming and placement of files automatically. The developer only needs to name the application and the knowledge sources.

System File

The system file contains a list of filenames identifying the blackboard structure description file, and all rule base and case description files for the system. The system file is identified as such by the suffix .sys. The file format is shown in FIG. 27.

Note that the order of files named in the system file is important. The name of the blackboard structure description file should be specified first, then all rule base description files, and finally all case description files. This is the order that is shown in FIG. 27. Only one file should be specified per line. All of the files specified in the system file should exist or initialization errors will occur.

The shell assumes that the files specified in the system file reside in the same directory as the shell executable files unless full pathnames are used in the system file.

There is an option available to determine whether to fully open a knowledge source window or iconify it. The default system operation is to iconify all knowledge source windows. However, if a ,NORMAL is placed at the end of a knowledge source file specification line, then the window associated with that knowledge source's process will be fully opened. This feature is useful for making detailed observations of the operation of a particular knowledge source. If desired, all knowledge source windows can be fully opened by using the same ,NORMAL suffix on all knowledge source file specification lines. The default behavior (iconified knowledge sources) can be explicitly specified by using ,ICON at the end of a knowledge source specification line.

Blackboard Structure Description File

The blackboard structure description file (BSDF) contains the definition of all objects, and all attributes for each object. Objects and attributes are identified by names given by the user. The blackboard file is identified as such by the suffix .bb. The file format is shown in FIG. 28.

The names of the objects and associated attributes are used in the knowledge source description files, and in the input data files. Names must match exactly in spelling and case in order for the shell to operate properly.

Only blackboard data values of type double are allowed. There is no specific maximum history length. Since the blackboard will maintain data points it receives within this history length, excess memory will be used and the system will be slowed needlessly if the history length is longer than what is required by the knowledge sources. A good check on this is to review the history lengths required by knowledge sources and adjust the blackboard history lengths appropriately.

Significant data received by the blackboard can be forwarded to the user interface windows. Under the object's attribute, include the line, DEMON: MMI.sub.-- WRITE. When the blackboard receives a new value of this object attribute, the object and attribute names and the value will be forwarded to the man machine interface. The value will be shown in the man machine window. This is a powerful tool for working with the shell, since it allows any object attribute to be tracked as the system is running. However, if too many object attributes have the DEMON turned on, the system will be slowed, and the number of values printed in the man machine window will be large. Once an application is tested, the use of the DEMON should be reserved for significant object attributes, such as those representing malfunctions. This is a feature of only the prototype. The user interface is the proper destination for blackboard data.

Rule Base Description Files

Each rule base is defined by a description file that is comprised of three sections. The first section is a list of event expressions, called EVENTS. These expressions are used by the event detector to determine if a knowledge source should be placed on a list of knowledge sources to be fired which will be sent to the agenda manager. The second section is a list of event expressions, called PRECONDITIONS. These expressions are used by the agenda manager to check if a knowledge source should be fired at a given time.

For the EVENTS section, care should be exercised in writing event expressions that depend on the arrival of new data. Each event expression should refer to new data arriving from one source only (either the user interface or one of the other knowledge sources). All data is sent through the event detector, but each source of data (a knowledge source or the user interface) sends it in separate batches. Therefore, the event detector can only recognize data in a particular batch as new, even if data arriving from another source has the same time stamp. In general, caution should be exercised in writing event expressions with more that one "new" data point in the expression.

The PRECONDITIONS section contains expressions that are similar to those in the EVENTS section. Also, a periodic precondition can be set to cause a knowledge source to fire at regular intervals. This is done by placing a statement "every n" as a precondition, where n is the interval duration in seconds.

The third section defines the rule base structure, including all components of rule base such as hypotheses, malfunctions, rules, etc. A rule base description file is identified as such by the suffix .rb. Details of the file format are shown in FIG. 29.

The blackboard structure description file should be referenced and edited as necessary so that all object attributes named in the rule base as blackboard elements exactly match the names in the blackboard; mismatches will cause the rule base to fail to properly initialize.

There are many operators available in constructing a rule based description file.

Case Description Files

Each case base is defined by a description file that also contains three sections. The first two sections are EVENTS and PRECONDITIONS sections as described above. The third section contains the case base itself, consisting of a set of cases with values. A case description file is identified as such by the suffix .cb. Details of the file format are shown in FIG. 30.

As for the rule based description files, the object attributes in the case based files must exactly match blackboard object attributes, or a loading error will occur.

Each case should be comprised of a set of object attributes with associated case values. The time stamps used for the case values should reflect the required time intervals necessary for comparison; the absolute time is not important. For example, if in a particular case, an object attribute has a characteristic set of values over a 10 second period, the difference in the time stamps between the most recent and oldest values should be 10 seconds.

Input Data File

This file consists of the data that is to be used by the shell to simulate the arrival of actual data. The input data file is identified as such by the suffix .dat. The file format is shown in FIG. 31.

Input data is expected to be structured so that all data with a particular time stamp is grouped together in the same data set.

Object attribute names should exactly match the blackboard names. An error will be reported when the input data file is scanned if name mismatches occur.

The data in the input data file should appear in chronological order, from earliest data to latest data.

The input data file is intended only for testing purposes, to verify proper application operation.

Log Files

Each knowledge source that generates diagnostics writes to a Log File (RLOGF or CLOGF), with entries representing a diagnostic message with associated priority and severity measures. The syntax is shown in FIG. 32.

Diagnostic File

The Diagnostic File (DIAF) contains the results of a session run. It is a list of diagnoses with associated confidence factors. The syntax is shown in FIG. 33.

Blackboard Status File

The Blackboard Status File (BSF) is similar to the BSDF in that it contains information necessary to recreate the blackboard. Using the BSF file, the blackboard can be restored on a subsequent session run. The syntax is shown in FIG. 34.

Use of the Program

The user must be in the directory where the domain shell executable files reside. All input files should also be in this directory, unless full pathnames are used for files located elsewhere. Also, output files are written in this directory. The program opens at least five windows during execution so it is advisable to have a display with only one window currently open. This window can reside anywhere on the display, but it is recommended that it be placed in the lower left corner.

The program is invoked by typing the program's name followed by the system file name. As currently installed, the program's name is user.sub.-- int. This can be changed by the user if desired. However, the names of the other executable files should not be changed.

Windows will be opened for each of the domain shell processes: blackboard, event detector, agenda manager, man machine interface, and each knowledge source. All windows are xterm windows, and can be resized, moved, or iconified. Each window is appropriately titled in the title bar--knowledge source windows are identified by their respective description file names. All knowledge source files are initially iconified (unless the NORMAL window option was specified in the system file), but can be opened as desired by the user. Within a window, the user can select a variety of viewing and tracing options by placing the pointer within the window, hitting the left or the center mouse button while holding the Ctrl key down, and choosing the desired option. A scrollbar for the window can be enabled by hitting Ctrl-Center.sub.-- Mouse.sub.-- Button and choosing the option "Enable Scrollbar".

A window's title bar identifies the process running within it (with the exception of the user interface window, which is a standard terminal window that the user has previously opened). The knowledge sources are identified by the name of the knowledge source description file associated with it. When the windows are iconified, the knowledge source windows are still identified by the description file's name; the other processes are identified by two letter abbreviations--bb for blackboard, ed for event detector, am for agenda manager, and mm for man machine interface.

Most interaction with the user occurs in the first window, where the program was started. This window will present the user with a menu of top level options after the system is set up. There are four choices: Start Data, Continue Data, Set Operating Parameters, and End the Session.

Start Data--Option 1

This option, when chosen by the user, prompts him for the name of an input data file. It then notifies all knowledge sources to reset and prepare for a session run. After scanning the input data file, the program prints the length of time needed to run the data in seconds. The user is given the option of compressing the time scale in order to complete a data set run in a shorter or longer period of time. The compression factor is divided into time intervals extracted from the data file to determine the compressed interval. After the compression factor is set, data is read from the input data file and sent at the appropriate time to the event detector, which forwards it to the blackboard. The system will operate, firing knowledge sources as appropriate, until the input data is exhausted. Informational messages will appear in the shell windows as the data set run proceeds. When the run is over, the user is presented with the top level menu in the user interface window.

Evidence of the operation of the blackboard is shown by the use of the characters `>` and `<` in the blackboard window. When data is placed in the blackboard, the `>` character is printed; when data is retrieved from the blackboard, the `<` character is printed.

The event detector will print out a set of three `.` characters as it proceeds with the evaluation of event expressions. The agenda manager will also show a set of three `.` characters indicating the completion of an activity. The man machine interface will print received data in its window as the blackboard sends it. Each data point sent will be displayed along with the object and attribute names. Only those object? attributes with DEMON: MMI.sub.-- WRITE will be displayed, and only when a new value is received by the blackboard.

If Start Data is chosen again after a data set has been run, then all data in the blackboard is discarded and all knowledge sources are reset. This, in effect, starts the session over. For continuing a run with further data, use Option 2, Continue Data.

Continue Data--Option 2

This option causes the system to run a data set in a manner identical to that for Option 1--Start Data. However, for the Continue Data option no messages are sent to knowledge sources to reset, and the blackboard data is retained from the previous run. This allows the rule bases to continue operation with current values that were set as a result of operations during a previous data set run. As for Option 1, the user is prompted for the name of an input data file. Data in this file should be begin with a time stamp that is chronologically later than the last data in the previous data set in order for this option to operate correctly. If further data is sent to the blackboard with time stamps earlier than data from a previous run, the blackboard will place the data in the blackboard as a current value for an attribute with no history. However, for attributes with non-zero history length, the blackboard will insert the value at someplace in the history other than as the latest value. This will cause indeterminate behavior as the event detector may fire a knowledge source based on the arrival of "new" data; when the knowledge source retrieves the data from the blackboard, the data is hidden and the knowledge source fires using possibly incorrect data points.

When the data set is running, the appearance of the shell processes is identical to that for Option 1--Start Data.

Set Operating Parameters--Option 3

This option allows the user to set parameters for rule bases. If this option is chosen, the user is prompted for the name of a rule base. Only rule bases have the option of setting operational parameters. The case based knowledge sources have no Set Parameter options. There are six choices for setting parameters: Trace, Log, Step, Breakpoint, Alpha/Beta, and SF/NF.

If Option 3 is selected by the user, he is then prompted to enter the name of a knowledge source file. This specifies the knowledge source file for which the parameter is to be set. Currently, only rule bases have parameters that can be set. After the knowledge source file is specified, the user is then prompted to enter the code corresponding to the parameter to be set.

Trace--Parameter Option 0: If this option is chosen, the user is asked whether to disable or set a tracing capability. When set, this causes detailed descriptions to be displayed in the rule base window when each rule in the rule base is fired.

Log--Parameter Option 1: If this option is chosen, the user is asked whether to disable or set a logging capability. When set, this causes descriptions identical to those generated for the Trace option to be sent to a file. The file is named with a root name the same as the rule base description file that created it, with the .log extension.

Step--Parameter Option 2: If this option is chosen, the user is asked whether to disable or set the step functionality. When set, the Step option causes the rule base to stop after each rule is fired; the rule base will continue only when the user acknowledges the rule firing by responding in the rule base window. Therefore it is necessary for the user to change his focus of attention to the rule base window when this option is set. When the rule base fires, the processing will stop and the user will have options within the rule base. Data will continue to be sent to the blackboard, and all other shell processes will proceed. However, further knowledge source firings will be delayed until the user has completed stepping through the rules in the rule base. Execution of the rest of the shell will therefore be disabled. The purpose of the Step option is to allow the user to follow in detail the sequence of rule firings in a rule base. Since its use generaly ruins the timing of process execution, it should only be used in configurations with only one knowledge source, for debugging purposes.

Breakpoint--Parameter Option 3: If this option is chosen, the user can set or remove breakpoints at rules in a rule base window. In order to use this option, the user must move to the appropriate rule base window in order to set the breakpoints. In the rule base window, the user can set and remove breakpoints for any rule in the rule base. Upon completion, the user must return to the first window to choose a top level option.

As with the Step option, rule base operation is suspended during firing if breakpoints are set. The use of breakpoints is for observation of rule base operation, rather than shell performance as a whole. In other words, it should only be used in configurations with only one knowledge source, for debugging purposes.

Alpha/Beta--Parameter Option 4: If this option is chosen, global values for alpha and beta cutoffs can be set for a particular rule base. The user is prompted to enter values for alpha and beta (from -1.0 to +1.0). These values are then passed to the rule base specified.

SF/NF--Parameter Option 5: If this option is chosen, global values for the sufficiency and necessity factors (SF and NF) for rules can be set for a particular rule base. The user is prompted to enter values for SF and NF (from -1.0 to +1.0). These values are then passed to the rule base specified.

End the Session--Option 4: If this option is chosen, the session is ended and the program exits. Output files are written as described elsewhere. Each knowledge source generated a log file that contains a list of diagnoses. The blackboard writes an output file that contains the structural information from the blackboard input file, and a snapshot of all data values currently stored in the blackboard.

Output Files

When the session is ended, each of the knowledge sources prints out at least one output file that contains the results of operation. A rule base may print out a log file if that parameter has been set through the set parameter option.

Each time a session has ended after a set of data has been run, every rule base for the system will create an output file with the results of diagnosis. This file has the same root filename as the rule base description file, but with the suffix .out. The results of diagnostics generated each time the rule base was fired are written into this file. The data written includes the diagnoses that are reached, the number of rules that were fired, and the number of rules fired per second.

If the LOG option has been selected for the rule base, then an output log file is created. This file has the same root filename as the rule base description file, but with the suffix .log. This contains detailed messages that indicate the sequence of operation of the rule base.

The case based processes will write out the results of scoring cases into a file with the same root name as the case description filename's root, and with the suffix .out. The file will contain a record of the results of scoring over a complete data set run.

The blackboard produces an output file that contains all of the object and attribute information from the input file plus all of the data currently stored in the blackboard. This file can be used as an input file for subsequent session runs. In this case, input data sets should contain time stamps chronologically later than the latest data in the blackboard, or indeterminate behavior will result.

Errors

Errors encountered in using the shell can generally be divided into two categories: syntax/loading errors and logical errors. If a particular knowledge source encounters an error, it will print an error message identifying the line number in the file where the error is located. An error message is sent to the user interface. This causes the user interface to try to kill the shell processes and exit.

Logical errors are causes when the information contained in the knowledge source files does not correspond to the desired performance due to incorrect rules, etc. These errors may be difficult to locate. The shell provides several tools to assist in following the operation of the individual shell processes. These include the Set Parameter Options for the rule bases. Also, the values of object attributes posted on the blackboard can be printed in the man machine window using the DEMON feature. All of the output files can be used to assist in discovering the error.

Knowledge Sources

Knowledge sources are the actual repositories of domain knowledge in a blackboard architecture. This section details some general characteristics of knowledge sources, after which three different classes of knowledge sources are examined in some detail. For the first class, rule-based, two different ways to use them are described, essentially giving two types of rule-based knowledge sources. For the other two classes, case-based and model-based, one type of each is described. More classes, and more types for any class can be added, as long as the knowledge sources satisfy the interaction requirements with the control module and with the blackboard itself.

General Characteristics

In the most general terms, a knowledge source can be thought of as a very large rule:

IF (precondition) THEN (execute body of knowledge source).

Thus, in order to execute, a knowledge source must first meet a set of preconditions. These preconditions must be defined a priori. In many typical blackboard applications, each control cycle begins by checking each knowledge source's preconditions. This is a very inefficient approach. Since our domain shell is strictly an event driven one, a further prerequisite must also be defined a priori: a list of events that will trigger the checking of the preconditions.

The size of a knowledge source is unconstrained. As mentioned earlier in this document, very small knowledge sources execute very fast, but lead to poor control overhead to execution time ratios. Large knowledge sources improve this ratio, but lead to unresponsive characteristics. Since large size cannot be precluded, knowledge sources must be further characterized as interruptible and resumable. Interruptible knowledge sources have to make known to the agenda manager the conditions which must be occurring in order to be interrupted, and the conditions for it to resume. Both actions thus can be related to task priority or changing context.

Knowledge sources reason about the state of the "world", which is represented by the global data structures of the blackboard. As such, every knowledge source has direct read access to any data on the blackboard. All knowledge sources also have write access to the blackboard. This however is indirect, being done by the communications manager/event detector component of the control module. This is a necessary modification of the standard blackboard architecture, caused by the nature of the domain: one knowledge source may generate hypotheses which are triggering events for other knowledge sources. Since knowledge sources are independent of each other, a clearinghouse is needed to mediate these situations.

Furthermore, since knowledge sources may generate competing hypotheses, they must not obliterate each other. Hence, care needs to be used in developing the blackboard, such that the sources of hypotheses are recorded and further reasoning about the hypotheses can be carried out by yet other knowledge sources. Each knowledge source in turn may have to keep its own copy of some portion of the state of the "world", necessary to provide continuity in the next iteration.

As a general philosophy, a knowledge source should have to reason at a single level of abstraction (i.e., no vertical crossing in the HAS-PART hierarchy), and on a reasonable sized slice of the horizontal component of the hierarchy. On the other hand, there should be nothing to preclude it from doing otherwise.

Case-Based

Case-based reasoning is a full fledged area of research in the field of Artificial Intelligence, concerned with the theory of human cognition. It addresses issues of memory, learning, planning and problem solving. Its practical goal, as reflected in the various attempts at developing case-based reasoning systems, is the automated interpretation and learning of events. A general, somewhat complicated approach is illustrated in the flow chart of FIG. 35. Very briefly, the following steps are required by a full implementation of such case-based reasoning: memory. and tested again.

As seen in prior art embodiment of FIG. 35, there are 5 types of knowledge required for such an implementation: indexing rules, similarity metrics, modification rules, repair rules, and the case memory itself.

In the present invention, automated modification and repair are not implemented, since these concepts are not fully developed. A simple, straightforward approach will be used instead. In this approach, modification and repair are left as the responsibility of the system user(s). Indexing is also partially the responsibility of the user(s), in that the definition of a case requires the definition of the variables (features) that make up the case. Thus, the present invention offers a unique and more simplified case-based reasoning scheme.

The body of a case-based knowledge source consists then of a collection of previously stored cases (knowledge base), and an algorithm which can rank them by "closeness" to a given situation (inference engine).

Each case in a knowledge source is an instantiation of a generic case frame which is defined by the application developer. A frame can have any number of variables. An instance (case) is obtained by assigning values to the variables. Since, within a knowledge source all cases are defined to be instances of the same frame, a tabular method of storage lends itself as the method of choice for case memory. In addition, the concept of time must be represented. The scheme of the present invention uses a table, as shown in FIG. 36. Each row in the table corresponds to one case frame. Columns correspond to variables whose values form a case. Any variable can have a third dimension, time. A case's historical values are stored along this dimension. These values are matched against current historical values by a similarity measuring algorithm. If a variable doesn't have a third dimension, it is assumed that similarity is measured against the current value of the variable, and no history is kept.

In addition to this information, FIG. 36 shows that each variable var will have a function f and a weight w attached to it. A similarity measurement (matching) algorithm would calculate a similarity value as follows:

The matching functions F and f can be used in principle to perform various weighted "fuzzy" and exact operations (i.e., comparisons) or a combination of both. Ideas for matching formulas can be found in pattern recognition, fuzzy logic, or they can be ad-hoc. A library of such functions will be provided; others may have to be added by the user.

In general, the storing of new cases can be automatic, or under end user control. In some applications, if an algorithm that measures the "interestingness" or the "utility" of a new case can easily be defined, an automated approach could be considered. Utility measures, such as the number of times a case has been used, can also be used to determine less useful cases, which can then be replaced by new ones, after some pre-defined storage limit is exceeded.

A tabular form for storage of relevant parameter values for a set of cased will be developed. This form will allow sufficient speed, for a reasonably sized case memory, to operate in real-time. Similarity measures will be calculated procedurally. The individual data slots will have limited time dependency to show real-time functionality.

FIG. 36 shows a representation of a knowledge source's case memory, in accordance with the present invention. For each case composed of variables vari, the similarity measure will be calculated. Four functions f will be provided in the prototype: equal, less-than, greater-than, and match-points-on-curve. This last function will demonstrate the functionality of matching selected points on a time curve with current historical points, as shown in FIG. 37.

The case-based approach of the present invention is based on the idea that if a past case includes a pattern of points in time and an end result achieved with those past points, then if that pattern, or a close pattern in time and magnitude, is again encountered, then the identical result will be inferred to be true. In the prior art, only a magnitude scoring scheme was used in which comparisons in levels of closeness were determined only in a magnitude scale and not in a time scale. The present invention, provides a scheme in which comparisons and levels of closeness are determined in a magnitude scale as well as in a time scale. This scheme will be described below.

Each numerical data value that is specificed as part of a case in a case base has additional information associated with it. This information defines how the data value will be used when the case is scored. Each data value is associated with a specific object/attribute in the blackboard. This tells the case base scorer from where in the blackboard the data should be retrieved. A scoring function (FEQ, FLT, or FGT) tells the case base scorer how to compare live data to the data value. Live data is the data retrieved from the blackboard at run-time when the case base is fired. Note that more than one data value can be associated with a single object/attribute, if delta-times are specified. Delta-times specify that the numerical data value should not be compared with the latest value stored in the blackboard, but rather with an older value. If more than one numerical data value has been associated with a single object/attribute, each numerical data value except the first one must specify a delta-time. This tells the scorer how many seconds back from the latest value in the live data set to look for a value to use for scoring this particular numerical data value.

Before describing the features of time-magnitude scoring, it is necessary to explain the use of timestamps in the domain shell as it relates to case base scoring. Each data point in the blackboard has a timestamp that indicates the time when the data value was measured or recorded. This timestamp is used by the case-based knowledge source to determine which value from the set of values retrieved from the blackboard will be used for comparison to a given point in the case. The timestamp is relevant only if more than one value for a specific object/attribute is part of the case (delta-times are specified). If only one numerical data value is specified for a particular object/attribute, then the latest value stored in the blackboard is automatically used for scoring.

For any point in the live data set, the elapsed time difference between the timestamp of the latest value in the set and its own timestamp is used for determination of delta-time. For example, suppose that, for a particular object/attribute, the timestamp of the latest value is 1992 NOV 11 10:00:30 and the timestamp of an older data value is 1992 NOV 11 09:58:30. In this case, the corresponding delta-time is 120 seconds.

The application developer can specify that a history of values for a particular object/attribute be kept in the blackboard. If a case base uses delta-times for a specific object/attribute, then the blackboard must store at least that long of a history of received values, or case scoring cannot be done. For example, if the largest delta-time specified for a particular value in a case base is 1000 seconds, then the blackboard history length should be at least 1000 seconds in order to hold a sufficient amount of data. Even so, scoring can only be done if, when the case base is fired, there are at least 1000 seconds worth of data stored in the blackboard for that object/attribute.

Using magnitude scoring, a live data object/attribute value is assumed to be valid from the time indicated by its timestamp to the timestamp of the next newer value stored in the blackboard. Therefore, when using magnitude scoring on the case, data received in the blackboard that has a timestamp that corresponds to a smaller delta-time period from the latest timestamp will not be used for scoring, even if that live data value is much closer on the time axis to the case based value than the live data value that is actually used. The following is a numerical example. Consider a case data point with a delta-time of 60 seconds. Suppose that the blackboard contains a data point with a timestamp of 1000 seconds before the timestamp of the latest value, and a data point with a timestamp of 59 seconds before the latest timestamp. Even though the last-mentioned point is only 1 second away from the specified delta-time, the much older value of 1000 seconds ago will be used for scoring.

When time-magnitude scoring is used, two time intervals are specified in the case based for each numerical data value within a case. These time intervals define the amount of time before and after the nominal delta-time where the case base scorer is to look for data values in the live data retrieved from the blackboard. In other words, a time window is established around the delta-time value for each point. When the live data is examined, there are three possibilities: back further in time to get the live data value to be used for comparison. In other words, scoring for this particular numerical data value will be done as it would be with magnitude scoring. comparison. will be used for the comparison depends on the type of scoring that is associated with this numerical data value. For FEQ scoring, the live data value in the time window that is closest in magnitude to the case's numerical data value is used. For FLT scoring, the minimum live data value in the time window is used. For FGT scoring, the maximum live data value in the time window is used. For each of the three types of scoring (FEQ, FLT, and FGT), this represents the optimistic, or best case, selection of the data point. An alternative selection mode can be used. This is the pessimistic, or worse case, selction. For FEQ scoring, this would choose the live data value in the time window that is farthest away in magnitude from the case's numerical data value. For FLT scoring, the maximum value in the time window would be used. For FGT scoring, the minimum value in the time window would be used.

Once the appropriate data value from the live data is selected, scoring proceeds in the same way as it does for magnitude scoring.

Time-magnitude scoring is useful for scoring case bases where the arrival times of data are uncertain, since it allows the developer to tell the scorer how symmetric of a view around the nominal delta-time it should take. With magnitude scoring, the view is fixed and asymmetric, since the developer cannot change it and it only looks at data with the same time or older than the specified delta-time.

Time-magnitude scoring is also useful for allowing the case base scorer to choose the best value for comparison from among a set of live data values near the case data value. This can enhance the case matching capability for applications with large amounts of data. With magnitude scoring, only the closest single value with the same time or just older than the delta-time is used. However, if the time windows for each data point are made too wide, then run-time performance will suffer since the scorer will have to consider many points as potential candidates for scoring with each numerical data value.

An additional feature of time-magnitude scoring is that different time windows can be associated with each numerical data point. This allows fine tuning of the case matching algorithm to achieve performance enhancement within a specific domain.

Having now described a limited number of embodiments of the invention, it should now be apparent to those skilled in the art that numerous other embodiments and modifications thereof are contemplated as falling within the scope of the present invention as defined by the appended claims.

## Claims

1. An artificial intelligence software shell for plant operation simulation comprising: elements and concepts, the blackboard module storing data values corresponding to the objects, each stored data value having an assigned time variable; artificial intelligence operation scheme, in communication with the blackboard module, operating on new case data points for comparison with stored data values; at least one knowledge source module, enabling data to be inputted to the shell; and case-based knowledge source module, receiving all input data and controlling operation of the case-based knowledge source; intelligence operation scheme of the case-based knowledge source each new case data point is assigned a time window within which a stored data value is selected for scoring the new case data point based on a level of closeness in time and magnitude between the new case data point and the stored data value.

2. A software shell as claimed in claim 1 wherein the control module includes: receiving all input data and determining when the case-based knowledge source module should execute; and knowledge source module and the event detector module, executing the case-based knowledge source module in accordance with a predetermined knowledge source priority scheme.

3. A software shell as claimed in claim 2 further including: propagation scheme including rules in if-then-else form with associated levels of belief.

4. A software shell as claimed in claim 3 wherein the case-based knowledge source module further includes: whereupon execution of the case-based knowledge source, the conditions are inferred to be true if a certain level of closeness is found between received data and the patterns.

5. A software shell as claimed in claim 3 wherein the blackboard module database includes a hierarchy of objects having vertical hierarchial connections and horizontal links.

6. A software shell as claimed in claim 5 wherein each blackboard object has attributes and each attribute has at least one value, the database including a hash table and plurality of pointers for linking the objects and corresponding attributes and values.

7. A software shell as claimed in claim 5 wherein the vertical hierarchical connections include IS-A and PART-OF hierarchical connections.

8. A software shell as claimed in claim 3 further including: attribute/value pairs for each object; knowledge source and a description of execution preconditions for the rule-based knowledge source; and knowledge source and a description of execution preconditions for the case-based knowledge source; file, case-based description file, and input data file are user created.

9. A software shell as claimed in claim 8 further including: completed, including diagnoses made by the rule-based knowledge source and case matches found by the case-based knowledge source; and information as modified by any knowledge sources after completion of each input data file cycle.

10. A software shell as claimed in claim 2 wherein the case-based knowledge source module further includes: whereupon execution of the case-based knowledge source, the conditions are inferred to be true if a certain level of closeness is found between received data and the patterns.

11. A software shell as claimed in claim 2 wherein the blackboard module database includes a hierarchy of objects having vertical hierarchial connections and horizontal links.

12. A software shell as claimed in claim 11 wherein each blackboard object has attributes and each attribute has at least one value, the database including a hash table and plurality of pointers for linking the objects and corresponding attributes and values.

13. A software shell as claimed in claim 11 wherein the vertical hierarchical connections include IS-A and PART-OF hierarchical connections.

14. A software shell as claimed in claim 2 wherein the activation/agenda manager module includes a mechanism for interrupting execution of a knowledge source and executing a higher priority knowledge source in accordance with the knowledge source priority scheme.

15. A software shell as claimed in claim 14 wherein the activation/agenda manager module includes a mechanism for determining whether an interrupted knowledge source should be rescheduled for execution.

16. A software shell as claimed in claim 2 wherein the event detector module includes a data structure implementing an algorithm such that when data is received, only a knowledge source which operates on the received data is checked for execution availability.

17. A software shell as claimed in claim 1 wherein the case-based knowledge source module further includes: stored case.

18. A software shell as claimed in claim 17 wherein the case-based knowledge source module further includes: stored in a row of the table; and at least one variable.

19. A software shell as claimed in claim 1 wherein each new case data point includes an associated scoring function indicating the type of comparison between the new case data point and the stored data value.

20. A software shell as claimed in claim 19 wherein scoring function includes a minimum data value scoring function.

21. A software shell as claimed in claim 19 wherein scoring function includes a maximum data value scoring function.

22. A software shell as claimed in claim 19 wherein scoring function includes closest in magnitude data value scoring function.

23. An artificial intelligence software shell for plant operation simulation comprising: concepts and storing data values corresponding to the objects, each stored data value having an assigned time variable; artificial intelligence operation scheme, in communication with the means for storing, operating on new case data points for comparison with stored data values; knowledge source module, for enabling data to be inputted to the shell; and knowledge source module, for receiving all input data and controlling operation of the case-based knowledge source module; intelligence operation scheme of the case-based knowledge source each new case data point is assigned a time window within which a stored data value is selected for scoring the new case data point based on a level of closeness in time and magnitude between the new case data point and the stored data value.

24. A software shell as claimed in claim 23 wherein the means for receiving and controlling include: the case-based knowledge source module should execute; and the means for determining, for executing the case-based knowledge source module in accordance with a predetermined knowledge source priority scheme.

25. A software shell as claimed in claim 24 further including: propagation scheme including rules in if-then-else form with associated levels of belief.

26. A software shell as claimed in claim 25 wherein the means for storing includes a database having a hierarchy of objects having vertical hierarchical connections and horizontal links.

27. A software shell as claimed in claim 26 wherein each object has attributes and each attribute has at least one value, the database including a hash table and a plurality of pointers for linking object and corresponding attributes and values.

28. A software shell as claimed in claim 27 wherein the means for executing includes means for interrupting execution of a lower priority knowledge source and executing a higher priority knowledge source in accordance with the knowledge source priority scheme.

29. A software shell as claimed in claim 28 wherein the means for determining includes means for receiving input data, determining when knowledge source execution preconditions are met, and checking only a knowledge source whose execution preconditions are met for execution availability.

30. A software shell as claimed in claim 29 further including: attribute/value pairs for each object; knowledge source and a description of execution preconditions for the rule-based knowledge source; knowledge source and a description of execution preconditions for the case-based knowledge source; file, case-based description file, and input data file are user created.

31. A software shell as claimed in claim 30 further including: completed, including diagnoses made by the rule-based knowledge source and case matches found by the case-based knowledge source; and information as modified by any knowledge sources after completion of each input data file cycle.

32. A software shell as claimed in claim 31 further including stream sockets for intercommunication, the sockets communicating messages in the form of a request-response pair.

33. A software shell as claimed in claim 23 wherein the case-based knowledge module source further includes: whereupon execution of the case-based knowledge source, the conditions are inferred to be true if a certain level of closeness is found between received data and the patterns.

34. A software shell as claimed in claim 33 wherein the data comparison scheme compares both magnitude and timing of the data upon execution of the case-based knowledge source.

35. A software shell as claimed in claim 34 wherein the case-based knowledge source module further includes: stored case.

36. A software shell as claimed in claim 35 wherein the case-based knowledge source module further includes: stored in a row of the table; and at least one variable.

37. A method of simulating plant operation with an artificial intelligence software shell comprising the steps of: and data values corresponding to the objects each data value having an assigned time variable; data point having an associated time window variable; artificial intelligence knowledge source should execute in accordance with a predetermined knowledge source priority scheme; and determination; values from within a time window defined by the time window variable for scoring a data point based on a level of closeness between the data point and the data value in time and magnitude closeness to data in a stored case.

38. A method as claimed in claim 37 wherein the step of executing at least the case-based knowledge source includes the step of updating object values.

39. A method as claimed in claim 38 wherein the step of executing at least the case-based knowledge source further includes the steps of: propagation scheme including rules in if-then-else form with associated levels of belief; including predefined patterns and conditions.

40. A method as claimed in claim 39 wherein the step of executing case-based knowledge sources includes the step of inferring to be true the conditions if a certain level of closeness is found between received data and the patterns.

41. A method as claimed in claim 37 wherein the step of storing includes the step of storing objects, attributes and values, each object having an attribute and each attribute having at least one value.

42. A method as claimed in claim 41 wherein the step of executing at least the case-based knowledge source includes the step of interrupting execution of a lower priority knowledge source and executing a higher priority knowledge source in accordance with the knowledge source priority scheme.

43. A method as claimed in claim 42 wherein the step of determining further includes the steps of determining when knowledge source execution preconditions are met and checking only a knowledge source whose execution preconditions are met, for execution availability.

44. A method as claimed in claim 43 further including the steps of: and attribute/value pairs for each object; rule-based knowledge source and execution preconditions; and of execution preconditions; and

45. A method as claimed in claim 44 further including the steps of: knowledge sources and case matches found by the case-based knowledge sources; and modified by any knowledge sources during execution.

46. A method as claimed in claim 45 further including the steps of communicating messages through sockets between modules in the form of request-response pairs.

47. A case-based knowledge source module for an artificial intelligence software shell for plant operation simulation, the shell including a blackboard module database having objects representing plant elements and concepts, and a control module for receiving data and controlling operation of the case-based knowledge source module on the blackboard objects, the case-based knowledge source module comprising: of stored data points and an associated time value for each stored data point; and is found between data received and the stored data points in both magnitude and time, a condition is inferred to be true; having an assigned time window value, and a stored data point is selected from within the time window to score the new data point based on a level of closeness in time and magnitude between the stored data point and the new data point.

48. An artificial intelligence software shell comprising: associated with objects representing plant elements and concepts, each past data point having an associated time variable; and module, receiving new data points, each new data point having an associated time window variable defining a time window, the case-based knowledge source module, for each new data point received, selecting a past data point from within the time window based on a level of closeness between the past data point and the new data point for scoring the new data point.

49. A case-based knowledge source module for an artificial intelligence software shell for plant operation simulation, the shell including a blackboard module database having objects representing plant elements and concepts, and a control module for receiving data and controlling operation of the case-based knowledge source module on the blackboard objects, the case-based knowledge source module comprising: of stored data points and an associated time value for each stored data point; and associated time window variable, the time window variable defining a time window within which a stored data point is selected to score the received data point based on a level of closeness in time and magnitude between the stored data point and the received data point.