Author Service Interfaces for Client-Server Communication
You can model client-server connections between software components in software architectures in System Composer™ using client ports and server ports and associating service interfaces with these ports.
To expose services performed by a software component, create a server port on that component. To access those services from within another software component, create a client port on the second component and connect the two ports. The ball and socket icons represent server and client ports, respectively. You can also author client and server ports at the composition level, with client-server lines crossing multiple hierarchies.
A service interface defines the functional interface between client and server components. Each service interface consists of one or more function elements. Use the Interface Editor to author and edit service interfaces.
Edit the function signature to change the number and names of inputs and outputs. Edit function element properties as you would edit other interface element properties. Function argument types can include built-in types as well as bus objects.
Once you have defined a service interface in the Interface Editor, you can assign it to client and server ports using the Property Inspector. You can also use the Property Inspector to assign stereotypes to service interfaces.
To implement function behavior for components with client or server ports using
referenced Simulink® models, right-click a component and select
behavior, or use the
createSimulinkBehavior function. System Composer creates a new export-function model and links the component to the new
For a component with a server port, the model contains a Function Element block and a port-scoped Simulink Function block for each function element of the service interface associated with the server port. The Simulink Function blocks are preconfigured with a function interface specification to match each function element of the service interface. The Function Element block creates an exporting function port in the Simulink model. The attributes of the port are based on the service interface definition.
To implement the desired algorithm for each server function, open the Simulink Function blocks and add and connect the needed blocks and other modeling elements.
For a component with a client port, the model contains a Function Element Call block and a Function-Call Subsystem block containing a Function Caller block for each function element of the service interface associated with the client port. The Function Caller blocks are preconfigured with a Function prototype and argument specifications to match each function element of the service interface. The Function Element Call block creates an invoking function port in the Simulink model. The attributes of the port are based on the service interface definition.