Creating a Control Schema
A schema is a collection of interconnected functional operator blocks that form a control strategy. It is a graphical block-diagram that represents the algorithm that is to be executed on the target controller hardware. A sample schema is shown in Figure 2.1. This section provides a step-by-step description of how you could synthesize that schema.
|
|
(a) |
(b) |
Figure 4.5. (a) Blank schema document "Figure1PCM.scm";
(b) same schema document associated with module "PCM1_1"
in hardware interface "Figure1.hwi" of Figure 2.4.
Step 1.Create and Name a New Schema Document
To begin the design process, choose the New Document item in the File menu (or press the New Document button on the speed-bar menu). When Design Pad prompts you for the document type (as shown in dialog of Figure 4.2), choose the schema option. Design Pad will respond with a blank schema document window. Before you begin adding operators to the schema document, use the Save Document As item in the File menu to name your document and save it to disk. In the File Open/Save dialog shown in Figure 4.4, name your blank schema document 'Figure1PCM.scm' and press the Save button. Your blank document should resemble the one shown in Figure 4.5(a).
Figure 4.6. The Link Existing Schema dialog.
The background color of the blank schema document that you just created is white, indicating that it has not been associated with any specific hardware target module. The schema must be associated with a hardware module in order for it to be executed by that hardware module. Not having a schema link does not necessarily mean that the module is idle, since it could still provide access to its hardware resources (e.g., analog input, RS-232 communications port, pushbutton, etc.) to adjacent modules that do have schema associations.
To associate the new schema that you just created with the PCM-1 hardware module of Figure 2.4, click the right mouse button on the "PCM-1" faceplate image and select the Link Existing Schema item from the drop-down menu. Then, select the "Figure1PCM.scm" schema document that you just created, as shown in Figure 4.6. Once you have associated the schema document with a hardware module, you can open the schema by double-clicking on the module faceplate image (you can also right-click on the image and select Open Linked Schema from the drop-down menu).
Notice that the background color-light green of the linked schema document (shown in Figure 4.5*Â * (b)) matches the background color of the corresponding hardware module's title bar (shown in Figure 2.4). Notice also that the window title bar of the linked schema document labeled "Figure1PCM.scm:2 in PCM-1 -- Figure1.hwi"--includes the file name ("Figure1PCM.scm"), as well as the module name ("PCM-1") and hardware interface file name ("Figure1.hwi") where the schema will execute. The window title bar of Figure 4.5 *(*a) only provides the schema document file name since it is not linked to any hardware module.
Figure 4.5 (a) and Figure 4.5 b) represent two views of the same "Figure1PCM.scm" document (as indicated by the ":1" and ":2" suffixes on the file names). If you make a change in one view of the document, it is simultaneously reflected in the other view.
As a shortcut to creating a new schema, linking it to a hardware module, and then opening the file again, you can simply right click on the module faceplate image and select the Link New Schema item from the drop-down menu.
The hardware interface file stores a link to the schema file as a relative file path. Clearly, if the schema document filename is changed outside of the Design Pad G4 environment (e.g., using Windows Explorer), or if the schema document is moved to a different directory, the link stored in the hardware interface file will no longer be valid. Double-clicking on the module faceplate or selecting the Open Linked Schema menu item will no longer work properly. Processing the node configuration and/or attempting to download a program to the target hardware will also fail. To restore the document association, you can select the Edit Schema Link item from the drop-down menu and manually edit the file path (see Figure 4.7). If you need to search for the desired file, click the Browse button (illustrated in the left margin and located to the right of the edit control in the dialog box). The association between a module in the hardware interface file and a schema document can be removed altogether by selecting the Unlink Schema item from the drop-down menu.
Figure 4.7. Edit Schema Link dialog.
Step 2.Insert Functional Operator Blocks
You are now ready to begin creating a control schema. To begin, you will want to insert functional operator blocks into a blank schema document. The Operators menu contains all the operator blocks available in Design Pad G4, grouped by functionality (e.g., controller blocks, signal conditioning functions, logic operators). You can also access the available operators by clicking the right-mouse button anywhere in the background area of the schema document to activate the drop-down menu shown in Figure 4.8. Each operator is described in detail in the Design Pad Operator Reference publication number PDG-TR-2011/13.
Figure 4.8. Drop-down menu activated with mouse
right-click on schema document background.
Under the Controller Blocks sub-menu of the Operators menu, choose the PID Controller item. Design Pad G4 will attach a PID operator object to your cursor, and will "drop" it wherever you click the left mouse button. Thus, to position the PID block, move your cursor to the center of the document window and click the left mouse button.
Next, activate the drop-down menu of Figure 4.8 and choose Generic Hardware Operators ïƒ Analog Inputs ïƒ Standard. Design Pad G4 will attach the selected operator to your cursor until you press the left mouse button to release it. Position the Analog Input operator below and to left of PID operator block, as shown in Figure 4.9. Note that generic hardware operator is assigned a default name---"AInStd1" in this case. This name is just a label for the operator block and does not directly correspond to the physical hardware resource that the operator is associated with (i.e., "AinStd1" does not mean that the signal source for the operator is some input channel number 1). In fact, at this point, the Analog Input operator is not linked to any specific hardware resource in any module (section 4.5 describes how to make this link).
Continuing with schema design, insert a Modbus Register Broadcast operator (Generic Hardware Operators ïƒ Network Operators ïƒ Modbus ïƒ Register Broadcast (Analog)) above the Analog Input block.
Selection
Tool
At this point, your schema diagram should resemble the schema shown in Figure 4.9. You can change the position of any operator by "dragging" it. (With the Selection tool active, position the cursor within the operator and click the left mouse button. Hold the mouse button down while moving the cursor to the desired location, and then release the mouse button.) You can also change the position of several operators and signals at the same time. First, select the operators you wish to reposition by holding down the SHIFT key as you click the left mouse button on each object. Then, just drag the objects to their new location-simultaneously hold down the left mouse button and the SHIFT key on your keyboard while moving the cursor to the desired screen position.
Design Pad G4 also provides a selection box feature that is useful for selecting multiple operator objects at the same time. To activate the selection box, click the left mouse button over schema background (a location in the schema that does not contain an operator block, a signal wire, a text block, or any other object). Then, as you move the mouse (while holding the left button down),- Design Pad G4 displays a rectangular selection box. When you release the left mouse button, Design Pad G4 will select all the objects that are inside the selection box. (You can also select all schema objects by using the Edit ïƒ Select All menu item or the CTRL-A hot key.)
Figure 4.9. Initial stage of schema development.
As illustrated in Figure 4.9, your schema should have three operators (PID controller, Analog Input, and Register Broadcast) with no connections between them. You could now continue adding the remaining operators in Figure 2.1, or you could begin making connections between the existing blocks. The next subsection describes the process of connecting operators.
Step 3.Connect Operator Blocks
Â
The next step in the schema design process is to make connections between the operator blocks. That is, to feed the output of one operator to the input of another. Design Pad G4 supports three signal types: analog signals (floating point values) drawn in red, digital signals (boolean values, i.e., true/false or high/low) drawn in blue, and structure signals (data packages combining analog, digital, and other structure signals) drawn in green. These signal types cannot be directly mixed---you may not connect an analog signal to a digital one. (However, Design Pad does provide operators to convert from one type to the other.)
Operator blocks have input and/or output pins (I/O) that serve as connection points or "hot-spots". An I/O pin can be an operator input, or an operator output, but not both. It is drawn as a short line attached to a small circle: . An unfilled circle indicates that the pin is not connected. When the pin is connected, Design Pad G4 fills in the circle: . (Design Pad G4 will not draw the circle (filled or unfilled) if the Operator "Hot-Spots" item in the View menu is not selected. This can be useful when printing a schema.)
While every operator has at least one I/O pin, most have both input and output pins. For instance, the PID operator has 5 analog inputs (SP, PV, Kc, Ti, and Td); an analog output (M); and, a digital output (A/M), as shown in Figure 4.9. The Analog Input operator has a single analog output, and the Modbus Register Broadcast operator has two input pins (one analog and one digital).
New Signal Tool
The PID control schema of Figure 2.1 was designed under the assumption that sensor measurements from an external process are sampled by an analog input hardware resource of the controller. Therefore, the Analog Input operator signal was fed to the process variable (PV) input of the PID controller block. To make this connection in your schema, select the New Signal tool from the Tools menu (or press the corresponding button on the toolbar menu). Position the cursor over the output pin of the Analog Input block, click the left mouse button, and move the cursor away from the operator. You should notice that a signal "wire" now connects the Analog Input block to the cursor---Design Pad has switched into wiring mode. You can control the configuration of the signal wire with the mouse as follows:Â
•If you left-click on white space, a signal joint will be created, and you will remain in wiring mode. Signal joints, or "hot-spots" are useful when reshaping a signal. (Design Pad G4 will not draw the signal joints if the Signal "Hot-Spots" item in the View menu is not selected. This can be useful when printing a schema.)
•If you click the right mouse button while in wiring mode, the last signal joint will be deleted. If no signal joints remain, the wire will be removed, and Design Pad G4 will switch out of wiring mode and into normal mode.
•If you double-click the right mouse button, all signal joints will be deleted, the wire will be removed, and Design Pad G4 will switch into normal mode (out of wiring mode)
•If you click the left mouse button while the cursor is positioned over an operator I/O pin, the wire will be connected to that pin, and Design Pad G4 will switch into normal mode (out of wiring mode).
•If you click the left mouse button while the cursor is positioned over another signal, the two signals will be connected, and Design Pad G4 will switch into normal mode (out of wiring mode).
Figure 4.10 illustrates the connection process. A signal wire has been connected to the output of the Analog Input object. The cursor holds the active signal wire and is moving toward the PV input of the PID block. When the cursor is positioned over the PV input pin, the left mouse button will be clicked, thereby connecting the two blocks.
Figure 4.10. The Analog Input operator is about to be connected
to the Process Variable (PV) input of the PID Controller operator.
When a new signal is being created, Design Pad G4 displays the signal wire as linear dashed segments, with signal joints between segments. The dashed line indicates that the signal is selected. Signals that are not selected are drawn as solid lines. (A similar convention is used for operators as well---the outline of an operator is solid when not selected and dotted when selected.)
By default, schema documents have a blank background. However, when you are creating a schema, you may find it convenient to display a grid in the background (Figure 4.10 has the grid on). The grid can be a useful alignment tool when you are arranging objects. To activate the background grid, select the Grid item from the View menu. You can remove the grid by selecting the Grid item again.
The PID and Analog Input operators of your schema should now have a wire connecting them. The next step is to connect the same signal to the Register Broadcast operator. Position the cursor on the analog input pin of the Register Broadcast operator and click the left mouse button. While in wiring mode, move the cursor down until it is directly over the existing signal wire, and click the left mouse button again to make the connection.
The next section takes up the topic of operator properties and completes the process of creating the sample schema of Figure 2.1.