Sub-Schema Function Block
Operator Menu Location: Sub-Schemas
Operator Bitmap:
Functional Description:
The Function Block Sub-Schema operator is a user-defined custom operator. Its input/output definition (quantity/type) and its functional behavior (I/O mapping) are defined by a collection of interconnected graphical operators (a sub-schema).
A Function Block Sub-Schema can itself contain other Function Block Sub-Schema operators which themselves contain yet other Function Block Sub-Schema operators. The example schemas below illustrate this point. The schema diagram below contains a single Function Block Sub-Schema operator with four analog inputs and one analog output.
The underlying schema for the function block is shown below. It computes the root mean square (RMS) of its inputs and applies the result to its output (i.e., it computes the square root of the sum of the squares of the inputs).
Each input pin in the parent schema's Function Block Sub-Schema operator graphic corresponds to a like-named Float Variable operator in the subschema. For instance, the input labeled "fInputA" in the sub-schema graphic corresponds to the variable named "fInputA". That is, the variable named "fInputA" takes on the value applied to the sub-schema input pin labeled "fInputA".
The RMS sub-schema itself contains four Function Block Sub-Schema operators. Each sub-schema operator computes the square of its input signal as shown below:
Each function block diagram shown above represents an independent schema (.scm) file. The example above includes three schema files: FunctionBlockExample.scm (Figure A), RootMeanSquare.scm (Figure B), and Square.scm (Figure C).
A Function Block Sub-Schema must be linked to or associated with a schema (.scm) file that contains the desired functional behavior. In the example above, the sub-schema operator labeled "Root Mean Square" in Figure (A) is linked to the RootMeanSquare.scm schema of Figure B, and the four sub-schema operators in Figure (B) are individually linked to the Square.scm schema of Figure (C). Each sub-schema operator in Figure (B) represents a distinct instance of the Square.scm schema.
Unlike most operators, the Function Block Sub-Schema is not configured thru a property sheet. Instead, its configuration is defined by attributes of the linked schema file (e.g., quantity and type of I/O) and thru a drop-down menu. This drop-down menu is accessed by right-clicking on the operator icon graphic. It contains commands to manage the operator's link to a schema file. For instance, to link an existing schema file to the operator, select the Link Existing Schema item, and use the File Open dialog to select the desired file.
The schema link is stored as a relative file path to the parent schema. The link can be manually edited by selecting the Edit Schema Link item from the drop-down menu. This command is useful if the schema file is renamed or moved to a different directory outside of the Design Pad environment. The schema link can be removed altogether by selecting the Unlink Schema item from the drop-down menu.
Once a schema file is associated with a Function Block Sub-Schema operator, the file can be opened by double-clicking the left mouse button on the sub-schema graphic. The file can also be opened by selecting the Open Linked Schema item from the drop-down menu.
As indicated above, the operator's input and output pins correspond to like-named Variable operators in the linked sub-schema file. The input-pin type (e.g., analog or digital) must also correspond to the Variable operator type (e.g., Float or Boolean). Variables in the sub-schema file that are to serve as sub-schema inputs or sub-schema outputs must be explicitly identified as such. This is done within the Sub-Schema Setup dialog---to view the dialog select the Sub-Schema Setup item from the Schema menu. The dialog box (as pictured below) contains a list control (top left quadrant) and two list-boxes (top right quadrant) that identify sub-schema inputs and outputs. The list control on the left contains all sub-schema file Variable operators of Local scope (only variables with local scope can serve as sub-schema I/O). The two list-boxes on the right contain the subset of variables that are to serve as I/O. The ordering of the variables in the list-boxes corresponds to the ordering of the I/O pins in the sub-schema operator graphic. To change the pin order, simply drag the variable name from one position in the list-box to another. To identify a variable as a sub-schema input or output, select "YES" in the combo-box in the appropriate column and then click the Update button. (The changes are then reflected in the list-boxes on the right.)
Function Block Sub-Schema operators can be configured to execute conditionally or periodically. (This is defined in the When to Compute group control located in the lower left quadrant of the Sub-Schema Setup dialog). The Enable On combo determines when the underlying sub-schema file is to execute. If set to Always Enabled, the sub-schema will execute periodically, with a user-defined updated rate (the Periodic Compute Time). The sub-schema can be configured to execute at the same frequency as its parent schema executes or at a different user-specified frequency.
When the Enable On property is set for conditional execution the operator will include a digital input pin that dictates when the underlying sub-schema file is to execute. If set to Rising Edge, the sub-schema will execute at the instant that the digital input switches from LOW to HIGH. If set to Falling Edge, the sub-schema will execute at the instant that the digital input switches from HIGH to LOW. If set to Active High or Active Low, the sub-schema will execute whenever the input is HIGH or LOW, respectively.
Drop-Down Menu Commands:
Namespace. This property is used to uniquely identify multiple instances of the same Variable operator. When Namespace is activated, this operator's name (see Set Label command below) is pre-pended to Variable operators in the sub-schema file (or its associated sub-schemas) that have their Pre-Pend Name property also set to Namespace. A more complete description of variable namespaces can be found in the operator reference section for Variable operators.
Link Existing Schema. Associates an existing schema file (.scm) with the operator.
Link New Schema. Creates a new schema file and associates it with the operator.
Edit Schema Link. Permits manual editing of the link to the associated schema file. This is useful when the file name or path is modified outside of the Design Pad environment.
Unlink Schema. Deletes the association between the operator and schema file.
Set Label. A string label that identifies the operator. This name may be pre-pended to other operator names (e.g., FairNET Networking operators, Variable operators, etc.) to uniquely identify them. The name is also used in a module's Hardware Connection Window to specify the location of generic hardware operators that have been linked to that module.
Update Operator Pins. Updates the operator graphic to reflect the input/output definition of the linked schema file. The linked schema file contains Variable operators of Local scope that have been designated as a sub-schema input or output.
Open Linked Schema. Opens the linked schema document in a new window. If the document is already open, activates the window.
Process Linked Schema. Executes the Process Schema command on the linked schema file. As usual, processing results (e.g., errors, warnings, and other information) is displayed in the Message Window.
Comments:
•Only Variable operators with Local scope can be identified as sub-schema inputs or outputs.
•Sub-schemas cannot execute more frequently than their parent schemas. If the user-defined periodic compute time for the sub-schema is less than the periodic compute time of the parent schema, the sub-schema will execute whenever the parent schema executes.
•The Activation Behavior setting(s) in the lower right quadrant of the Sub-Schema Setup dialog do not apply to Function Block Sub-Schema operators.
See Also:
State Sub-Schema