In this lesson, you create a block definition diagram,
add block properties, add components, and create an internal block
diagram for the ControlSystem.
About this task
To add a basic architecture to the project in a block
definition diagram:
Procedure
- In the browser, open the DesignSynthesisPkg and select
the Block Definition Diagram folder.
- Right-click and select Add New Block Definition
Diagram.
- In the New Diagram window, enter the name Control
System Structure and click OK.
You cannot use the Populate Diagram option for this new diagram because
the blocks for this diagram are not already in the project.
- Select the Stamp Mode tool and the Block tool .
- Place three blocks in the diagram and click the Stamp Mode
tool to stop using the mode.
- Click in the blocks to replace the generated block names
with these block names: Sensor, Actuator,
and Controller.
- In the browser, open the blocks area and check for the
new blocks in the list.
- Return to the Control System Structure block definition
diagram.
- The new blocks are components of the ControlSystem. Using
the Directed Composition tool , add a composition association
between the ControlSystem block and each new block (the filled diamond
needs to touch the ControlSystem block). Follow these steps to define
the associations:
- Double-click the arrow end of the composition association
at the Sensor block to open its Features window.
- Set Name: sen. Set Knows ControlSystem as: cs. Click OK.
- Right-click the composition again and set the Display
Options to show the Name of End1.
- Right-click the composition association at the Controller
block and set the Display Options to show the Name of End1.
- Double-click the arrow end of the composition association
at the Actuator block to open its Features window. Set Name: to act.
Set Knows ControlSystem as: cs. Click OK.
- Right-click the composition again and set the Display
Options to show the Name of End1.
- Double-click the arrow end of the composition association
at the Controller block to open its Features window. Set Name: to
con. Click OK.
- Select the ControlSystem block in the browser and expand
the Attributes category. Copy the temperature attribute and paste
the attribute into the Sensor block and also into the Controller block.
- Select the Controller block in the browser and expand its
Attributes category.
- To display the PredefinedTypes package so that you can make selections from it,
double-click the project name on the browser. In the Properties tab, locate the
Browser::Settings::ShowPredefinedPackage property. To enable this property, check the box next to
the name. Click OK.
- Right-click and select Add New Attribute.
Follow these steps to add and define the attributes:
- Add an attribute with the Name heat_data and
a Type of bool.
- Select the heat_data attribute in the browser. Copy
it and paste it into the Actuator block.
- Add an attribute named setPoint of
type degC with an initial value of 40.0 to the Controller.
- Add an attribute named rating of
type deg with an initial value of 19.049 to the Actuator.
- Select the ControlSystem block in the browser and expand
the FlowPorts category. Follow these steps to add and define the flow
ports.
- Select and copy the temperature flow port. Paste it
into the Sensor block and the Controller block.
- Double-click the temperature flow port on the Sensor
and change the Direction to Out.
- Add a new flow port to the Controller block named heat_data of
Type bool.
- Select the flow port, and copy and paste it into the
Actuator block.
- Change the Direction of the heat_data flow port for
the Actuator to In.
- To display the ports in the blocks, select the blocks in
the diagram, right-click, and select the Display Options option. Click
the Compartments button. In the Compartments window, select Port and
click the Display button (shown here) to move it to the Displayed
column. Click OK twice.
- Verify that the components defined in the block definition
diagram, are displayed in the browser as Parts (act, con, and sen)
under the ControlSystem block.
Results
Your Control System Structure block definition diagram should
resemble this example.
Example
Adding
an internal block diagram
To complete the design,
the Sensor, Controller, and Actuator need to be connected in an internal
block diagram for the ControlSystem that provides the context for
these connections.
- In the browser, select the ControlSystem block and .
- Type the name
Control System Internal Structure
for
the internal block diagram.
- From the browser, drag the sen, con, and act parts from the ControlSystem
onto the internal block diagram.
- By default, the parts show their flow ports. Select the Connector
tool and draw a connection from the temperature
flow port of itsSensor to the temperature flow port of itsController.
- Draw another connection from the heat_data flow port of itsController
to the heat_data flow port of itsActuator.
- Check that the ports are pointing in the correct direction (In,
Out). Change them accordingly, if required, using the Features window
for each flow port.
- If the diagram frame is not showing, click the diagram white space
and invoke the context function Show/Hide Diagram Frame to reveal
the frame. Right-click on the frame to invoke . This setting
makes the temperature and heat flow ports of the ControlSystem block
visible on the frame. The ControlSystem delegates the data that it
receives on its temperature flow port to itsSensor. Likewise, the
Actuator delegates the heat that it provides to the heat flow port
of the ControlSystem.
The finished internal block diagram should resemble this example: