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:
From the Simulink Start Page, create a new Software Architecture Model.
On the toolstrip, select the Modeling tab, and then drag a software component onto the canvas to represent the main application. Name the component.
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.
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.
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).
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.
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.
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.
Add a new Service Interface for each client-server.
Name the service interface and connect it to the client-server ports.
Click the client or server port in the diagram.
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 isAccelPdlTrqReq_Srv
, and the service interface name isAccelPdlTrqReq_SrvIf
.
Click the Add element to selected interface icon
and define the function based prototype for each service interface.
See Also
Topics
- System Composer Concepts (System Composer)
- Author Software Architectures (System Composer)