"[expr]"). For example, you could set the Name of Sensor attribute of an Entry
Point to "[the temp of tank1]", where tank1 is an object with the variable or
parameter attribute temp.
This section lists the attributes that contain expressions, describes the type of expressions they may contain, and shows examples of some diagrams that use this feature.
"[the volume of mixing-tank-3]":
Note that object-name can be the name of any named G2 object, and attr-name can
be any user-defined attribute or the system attribute
name. The syntax for
g2-expression, g2-function, and g2-procedure is discussed in the sections below.
Using a G2 Expression
When you use a string of the form "[(g2-expression)]", you can use many G2
expressions in the attribute. NOL evaluates the expression and replaces it with the
value returned.
the item.
Note: You must enter the expression the item with a single space between the two
words. If it contains a tab, line feed, or more than one space, NOL will not
recognize it.
When you run your application in a run-time or restricted use G2, you cannot use
a string of the form "[(g2-expression])". Instead, create a new function or procedure
that contains that expression and use a string of the form
"[(call function g2-function)]" or "[(call procedure g2-procedure)]".
Using a G2 Function or Procedure
With a string of the form "[(call function g2-function)]" or "[(call procedure
g2-procedure)]", you can call any function or procedure from the attribute. Unlike
using a G2 expression, you can call a function or procedure when your application is running in a run-time or restricted use G2.
function-name(var-name) = (.. . .)
procedure-name(blk: class gdl-block) = (item-or-value)
begin
. . .
return expression;
end
external. The output data value for
the entry point corresponds to the current value of the volume of the tank.
|
The following picture shows a tank object with a subworkspace. The subworkspace contains a NeurOn-Line diagram that reads the temperature and volume
from the tank and tests whether those numbers fall within certain limits. If they're
outside the limits, the NeurOn-Line diagram invokes the rules on the Rule Action
block. Under each Entry Point appears the value of the attribute Name-of-sensor.
|
| Prev
| Next | Start of Chapter | End of Chapter | Contents | Index | (10 out of 12)
Copyright © 1996, Gensym Corporation, Inc.