| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (3 out of 11)

Using the G2 to G2 Interface

Using the G2 to G2 interface requires that you configure the local knowledge base (KB) with one or more data interface objects, which are items of the G2-TO-G2-DATA-INTERFACE class. These objects inform the local G2 of the remote G2 process (or processes) with which to communicate. You then need to configure the KB for one or more types of data service or value or item passing.


Note: Though you need to configure only the client G2 with a G2 data interface, the remote server G2 process must allow the correct form of network access. Network access is described in Chapter 49, Network Security.

Creating Data Interface Objects

To create a data interface object:

Naming the Interface Object

For data service to operate properly, you must name each data interface object and that name must be unique within the KB. You use the name of the interface object to identify it within other objects and items. For example, if you use remote data service for a variable, use the name of the data interface object as the value of the variable's G2-to-g2-interface-name attribute.

Identifying Attributes

The Identifying-attributes attribute is only used with GSI interfaces and is not applicable to G2 to G2 interfaces as this time.

Setting the Warning Message Level

The Interface-warning-message-level attribute sets the severity level for error and warning messages that G2 will provide for the data interface object.

Warning message levels range from 0 to 3. Level 0 is the lowest severity level, and provides the least information. Increasing the warning message level causes G2 to provide more information about errors and failures that are otherwise only detectable through the value of the Interface-status attribute. Messages are posted to the Operator Logbook.

For example, when the warning message level is at 0 or 1, a failure to connect to the remote G2 process causes the Interface-status to change to failed, but no information is available about why the failure occurred. If the warning message level were set to 3 and the same connection failure occurred, G2 would post a message to the Operator Logbook describing why the connection failed.

The values for this attribute are:

Attribute value: Description:
default to warning message level
Error message defaults to the system-wide message level set in the Warning-message-level attribute of the Debugging Parameters system table.
0 (no warning or error messages)
Provides no information about errors and failures for the data interface object.
1 (serious error messages only)
Provides additional information about serious errors.
2 (all error messages)
Provides additional information on all error messages, including loss of a connection for active interfaces.
3 (all error and warning messages)
Provides additional information on all error and warning messages provided by level 2, and other messages about connection attempt failure.

During KB development and testing, it may be useful to set the value of this attribute to 3 to detect all data interface error and warning messages, and then to reset the value to 0 for KB deployment.

Defining the Connection Details

The Icp-connection-specification attribute defines information the KB needs to connect to a remote system. The connection information includes:

Specifying the Protocol to Use

G2 supports the use of two protocols: TCP/IP and DECnet. Not all platforms support both. You can also create a data interface object that connects to the G2 process itself. Such a connection is referred to as a local emulator. You can use the local emulator to test a KB running on a single G2 process that eventually will be connected to one or more remote G2s.

The syntax for the connection specification is:

To obtain the host-machine-name and either port-number or task-name:

Alternatively, you can obtain this information programmatically, using the system procedures G2-GET-HOST-NAME and G2-GET-PORT-NUMBER-OR-NAME, available in the sys-mod.kb.

Setting the Interface Timeout Interval

The Interface-timeout-period attribute controls how much time should elapse before the local G2 assumes that the G2 to G2 connection is inoperative and times out. You can create whenever rules in your KB to take appropriate action for a data interface object timeout.

The time specified here refers to the timeout limit for the network communications link, not to the update interval of any variable being used. Even if the update interval of every variable exceeds the interface timeout period, the local data interface object will not time out unless the network connection is lost.

Obtaining the Current Connection Status

The Interface-status attribute indicates the current status of the G2 to G2 connection. This is a read-only value, which changes with the state of the connection. Possible values are:

This value... Indicates that...
inactive
The interface is either on an inactive workspace, has no name, is otherwise not OK, or the local G2 has not started yet.
attempting
The interface is trying to make a connection to a remote G2, but has not yet completed the process and is not ready to transmit or receive data. Typically, the interface is in this state only briefly before obtaining either a connected or failed status.
connected
The interface has successfully connected to a remote G2 and is ready to transmit or receive data.
failed
The interface has attempted to make a connection to a remote G2, but the attempt was unsuccessful.
paused
The remote G2 is paused.
running
The remote G2 has been started or restarted and is not paused.
reset
The remote G2 has not been started or restarted.
timed-out
The local G2 has received no data from the remote G2 within a time interval given by the Interface-timeout-interval attribute of the interface object.

When you are creating a data interface object, the value of this attribute is always inactive until the interface object is activated.

Using Whenever Rules That Refer to the Connection Status

You can refer to the value of the Interface-status attribute to obtain the connection status, but you cannot change this value either interactively or programmatically. For instance, you could write a rule such as the following, to test for and take action upon a particular status.

Starting the G2 Processes

To start the G2 to G2 connection, start G2 on both computers. When the local G2 needs data from the remote G2 process, it obtains it in whatever way the KB is configured to pass data: data service, or value or item passing through remote procedure execution.

Activating Data Interface Objects

Locating data interface objects upon an activatable subworkspace lets you control the objects programmatically. By activating or deactivating the subworkspace upon which a data interface object resides, you can activate or deactivate the object.

You can also use a conclude action to control activation. Concluding the Icp-connection-specification attribute to have no value closes the connection. Here are two action buttons that use conclude actions to activate and deactivate the connection.


The g2-to-g2-data-interface Class

The class-specific attributes of G2-TO-G2-DATA-INTERFACE objects are:

Attribute Description
Names
The name of the interface object.
Allowable values:
Any unique name
Default value:
none


Identifying-attributes
For GSI interface only.
Allowable values:
Not applicable.
Default value:
none


Interface-warning-message-level
The severity level of error and warning messages about which G2 provides information.
Allowable values:
0 - 3
Default value:
default to warning message level


ICP-connection-specification
The information required for connecting, including the remote system, the protocol, and host name.
Allowable values:
See Defining the Connection Details.
Default value:
none


Interface-timeout-period
The length of time G2 waits before timing out after attempting to connect to the remote system.
Allowable values:
use default
any time-interval

Default value:
use default (10 seconds)


Interface-status
The current status of the interface object.
Allowable values:
See Obtaining the Current Connection Status.
Default value:
inactive

Creating Data Interface Subclasses

If you need additional user-defined attributes for your data interface object or want to provide a specific icon-description, create a new subclass by using a class definition. Specify the g2-to-g2-data-interface class as the direct superior class.

Once you have created a G2 data interface subclass, you can create any number of instances of it, each of which can specify a different remote G2 process. As a result, you may want to define a standard interface class as part of a KB and merge it into other KBs whenever they require the G2 to G2 interface facility.

If you are creating a subclass that uses multiple inheritance, the G2 data interface can be either a primary or a secondary superior class. For more information about creating subclasses, see Creating Class Definitions. For a description of primary and secondary superior classes, see Specifying the Superior Class(es).

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (3 out of 11)

Copyright © 1997 Gensym Corporation, Inc.