| Prev | Next | Start of Chapter | End of Chapter | Contents | Index | (3 out of 5)

Numeric Entry Point, Control Entry Point, Vector Entry Point, Belief Entry Point


Any Entry Point except a Vector Entry Point enters data into a diagram from a G2 procedure, variable, parameter, or GSI. Any Entry Point other than a Vector Entry Point can get its current value from one of two sources:

The name of the attribute that contains the G2 variable that is the embedded data source depends on the type of Entry Point, as described in "Reading the Output Value". For example, for a Numeric Entry Point, the name of this attribute is dp-out.

You configure the name of the G2 variable in the Name of Sensor attribute of the Entry Point. You configure how long the internal data is valid in the Validity Interval attribute of the entry point. You configure the data source, the formula, and the update interval of the embedded data source in the variable's subtable

You can toggle between the embedded and external data source while running your diagram to toggle between simulated and real-time data.

Using Entry Points to Obtain Data from a G2 Variable

You use Entry Points to obtain data from G2 variables. For example, you do this when you want to place all sensors for a diagram on a single workspace.

Entry Points obtain output data from one of two locations, depending on whether you are using an embedded or external data source:

You can switch between these two data sources by configuring the Data Source attribute of the block. The output value of the block depends on the data source the block is using.

When you configure the attributes of the block through the configuration panel, you are configuring the embedded data source, namely, the attribute of the block that contains a variable, for example, dp-out. Configuring the block has no effect on the external data source.

To configure the block to use an external or embedded data source:

  1. Create, name, and specify a G2 variable that supplies data to the Entry Point.

    Typically, the data server for this variable is an external data source, such as a GSI data server or G2. This variable is the external data source. You must specify the Formula and Default-update-interval attributes. You typically also specify the Validity-interval and Data-server attributes.

  2. Click on the embedded variable, for example, dp-out, select the subtable menu choice, and specify the attributes the embedded variable.

    This variable is the embedded data source. You must specify the Formula and Default-update-interval attributes. You do not need to specify the Validity-interval attribute because you configure this attribute for the block. Also, you do not typically specify the Data-server attribute because the variable typically simulates real-time data in its formula.

  3. Configure the Name of Sensor attribute of the Entry Point to specify the G2 variable that supplies data to the Entry Point.

    If the Data Source attribute is external, the named sensor must exist before you enter its name in the Name of Sensor. If the Data Source attribute is embedded, the named sensor does not have to exist before you enter it.

    When you configure the Name of Sensor, you are configuring the Name-of-sensor attribute in the subtable of the embedded G2 variable, for example, dp-out.

    You can specify the Name of Sensor as an expression that evaluates to a G2 variable. For more information, see "Evaluating Expressions in Attributes".

  4. Configure the Data Source to be either embedded or external.

    Embedded means the Entry Point will use the G2 variable stored in the attribute of the block, for example, dp-out. External means the Entry Point will use the external sensor whose value is stored in the Sensor-value attribute of the block.

  5. Configure the Validity Interval of the Entry Point to how long the value of the embedded data source remains valid.

    When you configure the Validity Interval, you are configuring the Validity-interval attribute in the subtable of the embedded G2 variable, for example, dp-out.

    The default Validity Interval is supplied, which means the Entry Point uses the Validity-interval supplied by the specified data source.

    Specify the Validity Interval as either a time interval, for example, 5 seconds, or indefinite, in which case the data value never expires.

    You can also override the Validity Interval given by an Entry Point by creating a rule that concludes a value directly into the dp-out output path attribute of the Entry Point, using the with expiration syntax, e.g., conclude that the dp-out of EP-1 = the current time with expiration (the current time + 5).

  6. Specify Value on Initialization to supply a default value when the Entry Point is reset.


Note: Initial values never expire, even if you specify Value on Initialization and Validity Interval for a block. Also, manual values that you provide by overriding the block never expire.
This figure shows a Numeric Entry Point whose Name of Sensor is pointing to a variable named float-var-1, which is the external data source. The configuration panel specifies a Validity Interval of 5 seconds, which determines the validity of the embedded data source. The default Data Source is embedded, which means the block uses the value generated by the dp-out embedded variable.


This figure shows the external data source, the variable named float-var-1, and its associated table. The variable generates random numbers between 1 and 10 once every 20 seconds, and the data is valid for 10 seconds.


This figure shows the table for the Numeric Entry Point, which contains the dp-out attribute and the sensor-value attribute, and the subtable for the dp-out attribute. The dp-out attribute defines an embedded variable, which is the embedded data source for the Entry Point. The embedded variable generates random numbers between 11 and 20 once every 10 seconds, as the subtable shows. Notice that the Validity-interval of the embedded variable corresponds to the Validity Interval attribute in the configuration panel for the block. The Sensor- value attribute shows the current value of the external data source, the variable named float-var-1.


Choosing Between Embedded and External Data Sources

By default, all Entry Points obtain their output values from the embedded data source, for example, the variable dp-out. You can cause the Entry Point to obtain its data from the external data source by reconfiguring the entry point. In this way, you can switch between simulated data that the embedded data source generates, and live data that the external data source generates.

To choose between embedded and external data sources:

When the block is obtaining its data from the embedded data source, for example, the dp-out variable, the arrow in the Entry Point's icon is black. When you configure the Data Source attribute to be external, the arrow in the Entry Point's icon changes to the active color of the block, whose default is cyan. In this way, you can determine the current data source.

Note that even when you are using the external data source, the value of the embedded variable that is the embedded data source, for example, the dp-out, continues to update. To verify that the block is using the correct data source, display the table for the output path of the block.

This figure shows the table for the output data path for a Numeric Entry Point when Data Source is embedded. Notice that the Data-value on the output data path of the Numeric Entry Point corresponds to the value of the dp-out embedded variable in the block's table. The output value is greater than 10, thus the inference output path of the High Value observation is true.


This figure shows the result of configuring the Data Source attribute to be external. Notice that the arrow on the icon of the Numeric Entry Point is now cyan, indicating it is using the external data source. The Data-value on the output data path of the Numeric Entry Point corresponds to the value of the Sensor- value attribute in the block's table, which is the current value of the float-var-1 external variable. The output value is less than 10, thus the inference output path of the High Value observation is false.


Using a G2 Variable Directly

You do not need to use an Entry Point to obtain data from a G2 variable in a diagram. Instead, you can connect variables directly to a path simply by dragging a path into the variable and making the connection. For more information on how to do this, see "Using Variables and Parameters".

Viewing the Variable

You can view the variable that is the sensor for a particular Entry Point, using a menu choice. This menu choice is especially useful if the Entry Point and the variable are on different workspaces.

To view the variable for an Entry Point:

NOL shows the workspace of the variable and places an arrow near the variable for a number of seconds. If the variable is embedded in another G2 object, the arrow points to that object, as the following figure shows.


Specifying the Embedded Value for an Entry Point

In addition to using a variable to set the output value for an Entry Point as described in "Using Entry Points to Obtain Data from a G2 Variable", you can set the output value of the embedded variable by using:


Note: The Data Output block performs the opposite action of the Entry Points; it passes information from a diagram to a G2 variable or parameter.

Using a Button

Buttons are especially useful when you are testing an application or creating a demo. They let the operator choose the value for an Entry Point. If you are using a slider, radio button, or check box, set the attribute Variable-or-parameter to the Entry Point's variable. If you are using an action button, use a conclude statement to set the Entry Point's variable.

For example, the following figure shows a slider that sets the output value for a Numeric Entry Point:


In this figure, an action button starts a sequence of action blocks.


Using a Rule or Procedure

A G2 rule or procedure can set the value for an Entry Point. Whenever the rule or procedure executes, it sets the value of the Entry Point, which then passes it. To set the value of the Entry Point, use a conclude statement.


Note: You cannot set the value of a Vector Entry Point with a rule or procedure.
This figure shows a Belief Entry Point that gets a value from a rule. Whenever any tank has a temperature over 100, the Entry Point passes along the status value.


The next figure shows a Control Entry Point that gets a value from the procedure process-bottles. When you call the procedure, the Entry Point passes along one control signal for each bottle.


This figure shows a Numeric Entry Point that gets a value from the procedure adjust-speed. The procedure decrements the value of the Entry Point by an amount you specify.


Using a Formula

You can give a formula to an Entry Point's variable. G2 evaluates the formula at the interval specified in the variable's Default-update-interval attribute.

To specify the formula:

  1. In the attribute table for the Entry Point, click on the attribute dp-out, ip-out, or cp-out, and select subtable from the menu.

    NOL displays the attribute's subtable.

  2. Edit the attribute Formula in the subtable.

  3. Set the attribute Default-update-interval to the interval at which you want NOL to evaluate the formula.



Using Your Own Variable Definition

You can replace the variable in an Entry Point with a variable created from your own object definition. This method is especially useful when the you would like to add attribute to the Entry Point or change the inheritance of the embedded variable.

To use your own variable definition:

  1. Create the variable definition.

    This figure shows a completed attribute table for a variable definition that uses GSI:


  2. Go into Administrator mode by selecting User Mode > Administrator from the Gensym menu.

  3. Delete the subtable for the Entry Point's variable by clicking on the variable in the Entry Point's attribute table, and selecting delete subtable from the menu that appears:


  4. Click OK in the dialog that G2 displays, asking you to confirm that you want to delete the subtable.


  5. Add a new subtable for your variable definition by clicking on the variable in the Entry Point's attribute table, and selecting add optional subtable from the menu that appears:


    G2 displays a menu asking you to choose a class.

  6. Choose g2-variable from the menu, and follow the menu hierarchy down until you see the name of the superior class used to define the new variable class specified in Step 1.

    The final menu contains your new variable definition. Click on the name of your variable definition.

    G2 displays the subtable for your variable.

  7. Edit the variable to suit your needs.


Using Vector Entry Points

To generate values from a Vector Entry Point, you override the block. You specify the dimension of the vector, and then the vector values.

To override a Vector Entry Point:

  1. Select the override menu choice on the entry point.

    NOL displays this dialog:


  2. Enter the dimension of the vector and select OK.

    NOL displays a spreadsheet for editing the vector values. For example, here is a spreadsheet for entering a 3-dimensional vector:


  3. Enter the values for each dimension, and select OK.

For more information about using the spreadsheet to edit vectors, see "Using the GXL Spreadsheet to Edit Data".

Making Vector Values Permanent

When you choose make permanent from a Vector Entry Point's menu, the block saves its current output value. If you later reset G2, the block restores that value, but that value is not passed until the block evaluates.

Configuring

This is the configuration panel for the Numeric Entry Point.


Attribute Description
Name of Sensor
The name of the G2 variable that supplies data to the Entry Point. The sensor you specify must exist when Data Source is external. For information on how to use an expression for the Name of Sensor, see "Evaluating Expressions in Attributes".
Data Source
Determines whether the entry point obtains its output value from the embedded variable, which is an attribute of the entry point, for example, dp-out, or from an external variable, which is the value of the Name of Sensor attribute. When Data Source is external, the arrow on the icon changes to the active color for blocks.
Validity Interval
The amount of time that the current value of the Entry Point remains valid, specified either as a time interval, for example, 5 seconds, or indefinite, in which case the data value never expires. The default Validity Interval is supplied, which means the Entry Point uses the Validity-interval supplied by the Name of Sensor variable. The specification of this attribute overrides the Validity-interval given by the variable.
Value on Initialization
See "Specifying an Initial Data Value".

This is the configuration panel for the Belief Entry Point.


Attribute Description
Name of Sensor
The name of the G2 variable that supplies data to the Entry Point.
Data Source
Determines whether the entry point obtains its output value from the embedded variable, which is an attribute of the entry point, for example, dp-out, or from an external variable, which is the value of the Name of Sensor attribute. When Data Source is external, the arrow on the icon changes to the active color for blocks.
Validity Interval
The amount of time that the current value of the Entry Point remains valid, specified either as a time interval, for example, 5 seconds, or indefinite, in which case the data value never expires. The default Validity Interval is supplied, which means the Entry Point uses the Validity-interval supplied by the Name of Sensor variable. The specification of this attribute overrides the Validity-interval given by the variable.
Logic
This attribute is not supported in NOL.
Status on Initialization
See "Specifying an Initial Status Value".
Output Uncertainty
This attribute is not supported in NOL.
Description when True, Description when False, Description when Unknown
These attributes are not supported in NOL.

This is the configuration panel for the Control Entry Point.


Attribute Description
Name of Sensor
The name of the G2 variable that supplies data to the Entry Point.
Data Source
Determines whether the entry point obtains its output value from the embedded variable, which is an attribute of the entry point, for example, dp-out, or from an external variable, which is the value of the Name of Sensor attribute. When Data Source is external, the arrow on the icon changes to the active color for blocks.
Value on Initialization
See "Specifying an Initial Data Value".

A Vector Entry Point has no configuration dialog. Instead, you override the vector entry point, as described in "Using Vector Entry Points".

See Also

For general information on how to use this block, see the sections below.

Click here for more information...
Basic Block Behavior
Overriding Block Values
Saving a Block's Data After Resetting G2
Specifying Initial Values
Starting and Stopping Data From Flowing
Reading the Output Value

| Prev | Next | Start of Chapter | End of Chapter | Contents | Index | (3 out of 5)

Copyright © 1996, Gensym Corporation, Inc.