Main Content

Create Architecture Model and Service Interface

After identifying the partitions between the main application and the service components, use System Composer™ to refactor the design. Create a software architecture model with the main application inputs and outputs, and set up the client-service interfaces for each connected service component. For more information, see Using Software Architecture Model Template (System Composer).

To open the software architecture model, run this command.

open("EVPwrCntrllrEMSysInitial.slx");

Create Main Application Component

To create the main application component:

  1. From the Simulink Start Page, create a new Software Architecture Model.

    Simulink Start Page showing the Software Architecture Model template located under the System Composer category.

  2. On the toolstrip, select the Modeling tab, and then drag a software component onto the canvas to represent the main application. Name the component.

    Software Component icon

  3. Create and name the input ports to the main application and on the boundary of the composition. Then, connect the ports from the composition boundary to the main application.

    System composer architecture diagram with inputs to the software component defined.

  4. Create and name the output ports from the main application and on the boundary of the composition. Then, connect the ports from the main application to the composition boundary.

    System composer architecture diagram with outputs from the software component defined.

Create Service Components and Define Client-Service Interface

Create the service components and define the client-service interface. For more information, see Author Service Interfaces Using System Composer (System Composer).

  1. On the toolstrip, select the Modeling tab from the toolstrip, and then drag a software component to the canvas for each of the service components. Name each component.

    Software Component icon

  2. Create the client-service interface between the main application and each service component. The server port is created as part of the service component, and the client port is created as part of the application component. The connection between these two components is called a service connector.

    System composer architecture diagram with client-service interface connections.

  3. Define the service interface in the Interface Editor. The service interface is the functional definition of the function itself. This method provides flexibility to define the full service interface in terms of the function prototypes and arguments. The software uses the service interface to create the model constructs for both the main application component and the service component.

    • To open the Interface Editor, on the Modeling tab, click the down arrow in the Design section and select Interface Editor.

    • Define a data dictionary location for the service interfaces by selecting Save to new dictionary.

      Drop-down with the options to Save to new dictionary or Link existing dictionary.

    • Add a new Service Interface for each client-server.

      Drop-down with the options to Add data interface, Add value type, or Add service interface.

    • Name the service interface and connect it to the client-server ports.

      • Click the client or server port in the diagram.

        Server port selected.

      • Right-click on the newly created service interface and select Assign to selected port(s).

        Note

        The service interface and the service connector should have distinct names to aid in readability for the two different elements. For this example, for the AccelPdlTrqRequest_ServiceCmp component, the service connector name is AccelPdlTrqReq_Srv, and the service interface name is AccelPdlTrqReq_SrvIf.

        Right-click menu with the options Assign to selected port(s) and Highlight port(s) using this interface.

    • Click the Add element to selected interface icon Add element to selected interface icon and define the function based prototype for each service interface.

      Function prototype definition for AccelPdlTrqReq_SrvIf.

See Also

Topics