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 compositionECU, double-click it.
| SW-C | Port | Add Port item | PORT INTERFACE | Setting |
|---|---|---|---|---|
SwcSensor | PpSpeed | PPort | IfSpeed | NON-QUEUED |
SwcSensor | RpScale | RPort | IfScale | CLIENT |
SwcActuator | RpSpeed | RPort | IfSpeed | NON-QUEUED |
SwcActuator | PpScale | PPort | IfScale | SERVER |
Creating the SW-Cs
-
Right-click an empty spot inside the frame. Hover over Add SWC and click Application.

Figure 4-1. ① Add SWC, ② Application.
-
Click the new SW-C. In the panel, enter
SwcSensorin both NAME and AS PROTOTYPE.
Figure 4-2. ① NAME, ② AS PROTOTYPE.
-
Create
SwcActuatorthe same way, belowSwcSensor.
Creating the Ports
Follow the port PpSpeed first.
-
Right-click near the right edge of
SwcSensor. Hover over Add Port and click PPort. A port appears on the edge.
Figure 4-3. ① Add Port, ② PPort.
-
Click the new port. Enter
PpSpeedin NAME, open PORT INTERFACE and clickIfSpeed.
Figure 4-4. ① NAME, ②
IfSpeedin the PORT INTERFACE list. -
A row for the data element
speedappears in the panel. Click NON-QUEUED in its COMSPEC column.
Figure 4-5. ① NON-QUEUED.
-
Create
RpScalethe same way with RPort, near the left edge. On a client-server port the row holds the operationGetScale. Click CLIENT.
Figure 4-6. ① CLIENT.
-
Create
RpSpeedandPpScaleonSwcActuatorfrom the table above. -
Press
Esc, then save withCtrl+S. Click Auto Layout in the toolbar under the canvas to arrange the frame, and save again.
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.
| From | To | Connector name (filled in automatically) |
|---|---|---|
SwcSensor / PpSpeed | SwcActuator / RpSpeed | Assembly_SwcSensor_PpSpeed_SwcActuator_RpSpeed |
SwcActuator / PpScale | SwcSensor / RpScale | Assembly_SwcActuator_PpScale_SwcSensor_RpScale |
-
Hold
Shiftand drag from the portPpSpeedto the portRpSpeed.
Figure 4-8. ①
PpSpeed, ②RpSpeed. -
Hold
Shiftand drag from the portPpScaleto the portRpScale. -
Click Auto Layout in the toolbar under the canvas and save with
Ctrl+S.
Figure 4-9. Both connectors. The positions may differ on your screen.
Why Is It Designed This Way?
- The naming.
Ppmarks a provided port andRpa 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
SwcActuatortoSwcSensor: there the actuator is the server.
Checklist
-
SwcSensorhas the portsPpSpeedandRpScale. -
SwcActuatorhas the portsRpSpeedandPpScale. - Selecting a port shows its PORT INTERFACE and the setting from the table.
- Two connectors join the SW-Cs.
- The tab
VehicleDesign:VFBcarries no modified mark.
Next Step
In Internal Behavior you add the runnables that use these ports.