Lesson 8: Building the architecture of the control system

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

  1. In the browser, open the DesignSynthesisPkg and select the Block Definition Diagram folder.
  2. Right-click and select Add New Block Definition Diagram.
  3. 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.
  4. Select the Stamp Mode tool and the Block tool Block tool.
  5. Place three blocks in the diagram and click the Stamp Mode tool to stop using the mode.
  6. Click in the blocks to replace the generated block names with these block names: Sensor, Actuator, and Controller.
  7. In the browser, open the blocks area and check for the new blocks in the list.
    Browser showing blocks
  8. Return to the Control System Structure block definition diagram.
  9. The new blocks are components of the ControlSystem. Using the Directed Composition tool 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:
    1. Double-click the arrow end of the composition association at the Sensor block to open its Features window.
    2. Set Name: sen. Set Knows ControlSystem as: cs. Click OK.
      Features window, General tab for sen part
    3. Right-click the composition again and set the Display Options to show the Name of End1.
    4. Right-click the composition association at the Controller block and set the Display Options to show the Name of End1.
    5. 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.
    6. Right-click the composition again and set the Display Options to show the Name of End1.
    7. Double-click the arrow end of the composition association at the Controller block to open its Features window. Set Name: to con. Click OK.
  10. 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.
  11. Select the Controller block in the browser and expand its Attributes category.
  12. 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.
  13. Right-click and select Add New Attribute. Follow these steps to add and define the attributes:
    1. Add an attribute with the Name heat_data and a Type of bool.
    2. Select the heat_data attribute in the browser. Copy it and paste it into the Actuator block.
    3. Add an attribute named setPoint of type degC with an initial value of 40.0 to the Controller.
    4. Add an attribute named rating of type deg with an initial value of 19.049 to the Actuator.
  14. Select the ControlSystem block in the browser and expand the FlowPorts category. Follow these steps to add and define the flow ports.
    1. Select and copy the temperature flow port. Paste it into the Sensor block and the Controller block.
    2. Double-click the temperature flow port on the Sensor and change the Direction to Out.
    3. Add a new flow port to the Controller block named heat_data of Type bool.
    4. Select the flow port, and copy and paste it into the Actuator block.
    5. Change the Direction of the heat_data flow port for the Actuator to In.
  15. 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.
    Compartments window
  16. 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

Block definition diagram

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.

  1. In the browser, select the ControlSystem block and Add New > Internal Block Diagram.
  2. Type the name Control System Internal Structure for the internal block diagram.
  3. From the browser, drag the sen, con, and act parts from the ControlSystem onto the internal block diagram.
  4. By default, the parts show their flow ports. Select the Connector tool Connector tool and draw a connection from the temperature flow port of itsSensor to the temperature flow port of itsController.
  5. Draw another connection from the heat_data flow port of itsController to the heat_data flow port of itsActuator.
  6. 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.
  7. 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 Ports > Show All Ports. 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:
Internal block diagram - finished

Lesson checkpoint

In this lesson, you learned the following:
  • Adding a block definition diagram
  • Adding blocks, properties, and associations
  • Adding parts to an internal block diagram
  • Connecting parts
In the next lesson, you add statecharts to specify the behavior of the components.