|
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
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.
dp-out, which is an embedded variable.
sensor-value.
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:
Formula and Default-update-interval attributes. You typically also specify the Validity-interval and Data-server attributes.
dp-out, select the subtable menu choice, and specify the attributes the embedded variable.
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.
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".
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.
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).
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:
Configure the Data Source attribute to be external or embedded.
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:
Choose go to sensor from the Entry Point's menu.
|
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:
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:
dp-out, ip-out, or cp-out, and select subtable from the menu.
Formula in the subtable.
Default-update-interval to the interval at which you want NOL to evaluate the formula.
|
|
To use your own variable definition:
|
delete subtable from the menu that appears:
|
|
add optional subtable from the menu that appears:
|
G2 displays a menu asking you to choose a class.
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.
|
To override a Vector Entry Point:
override menu choice on the entry point.
|
|
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.
|
This is the configuration panel for the Belief Entry Point.
|
This is the configuration panel for the Control Entry Point.
|
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.
| Prev
| Next | Start of Chapter | End of Chapter | Contents | Index | (3 out of 5)
Copyright © 1996, Gensym Corporation, Inc.