メインコンテンツまでスキップ

SW-Cs and Ports

What You Will Do​

In this chapter you create two application software components, SwcSensor and SwcActuator, inside the composition ECU, give each of them two ports, and join them with two connectors, one for each interface.

Before You Begin​

  • Start after finishing Interfaces.
  • Open the tab VehicleDesign:VFB. If you are not inside the composition ECU, double-click it.
SW-CPortAdd Port itemPORT INTERFACESetting
SwcSensorPpSpeedPPortIfSpeedNON-QUEUED
SwcSensorRpScaleRPortIfScaleCLIENT
SwcActuatorRpSpeedRPortIfSpeedNON-QUEUED
SwcActuatorPpScalePPortIfScaleSERVER

Creating the SW-Cs​

  1. Right-click an empty spot inside the frame. Hover over Add SWC and click Application.

    The Add SWC submenu

    Figure 4-1. ① Add SWC, ② Application.

  2. Click the new SW-C. In the panel, enter SwcSensor in both NAME and AS PROTOTYPE.

    The SW-C named SwcSensor

    Figure 4-2. ① NAME, ② AS PROTOTYPE.

  3. Create SwcActuator the same way, below SwcSensor.

Creating the Ports​

Follow the port PpSpeed first.

  1. Right-click near the right edge of SwcSensor. Hover over Add Port and click PPort. A port appears on the edge.

    The Add Port submenu

    Figure 4-3. ① Add Port, ② PPort.

  2. Click the new port. Enter PpSpeed in NAME, open PORT INTERFACE and click IfSpeed.

    Choosing the port interface

    Figure 4-4. ① NAME, ② IfSpeed in the PORT INTERFACE list.

  3. A row for the data element speed appears in the panel. Click NON-QUEUED in its COMSPEC column.

    The NON-QUEUED setting

    Figure 4-5. ① NON-QUEUED.

  4. Create RpScale the same way with RPort, near the left edge. On a client-server port the row holds the operation GetScale. Click CLIENT.

    The CLIENT setting

    Figure 4-6. ① CLIENT.

  5. Create RpSpeed and PpScale on SwcActuator from the table above.

  6. Press Esc, then save with Ctrl+S. Click Auto Layout in the toolbar under the canvas to arrange the frame, and save again.

    Both SW-Cs with their ports

    Figure 4-7. ① SwcSensor, ② SwcActuator. Auto Layout decides the positions, so the order on your screen may differ.

Connecting the Ports​

Join the two SW-Cs with two connectors, one for each interface.

FromToConnector name (filled in automatically)
SwcSensor / PpSpeedSwcActuator / RpSpeedAssembly_SwcSensor_PpSpeed_SwcActuator_RpSpeed
SwcActuator / PpScaleSwcSensor / RpScaleAssembly_SwcActuator_PpScale_SwcSensor_RpScale
  1. Hold Shift and drag from the port PpSpeed to the port RpSpeed.

    The two ports before connecting

    Figure 4-8. ① PpSpeed, ② RpSpeed.

  2. Hold Shift and drag from the port PpScale to the port RpScale.

  3. Click Auto Layout in the toolbar under the canvas and save with Ctrl+S.

    The connected SW-Cs

    Figure 4-9. Both connectors. The positions may differ on your screen.

Why Is It Designed This Way?​

  • The naming. Pp marks a provided port and Rp a required port, so a name alone tells the direction.
  • NON-QUEUED. The receiver wants the latest speed, not every speed.
  • Always from the provided port to the required port. A connector joins a provider and a requirer of the same interface. That is why the second drag runs from SwcActuator to SwcSensor: there the actuator is the server.

Checklist​

  • SwcSensor has the ports PpSpeed and RpScale.
  • SwcActuator has the ports RpSpeed and PpScale.
  • Selecting a port shows its PORT INTERFACE and the setting from the table.
  • Two connectors join the SW-Cs.
  • The tab VehicleDesign:VFB carries no modified mark.

Next Step​

In Internal Behavior you add the runnables that use these ports.