Main Content

Author Software Architectures

Software architectures in System Composer™ provides capabilities to author software architecture models composed of software components, ports, and interfaces. Use System Composer to design your software architecture model, simulate your design in the architecture level, and generate code.

Use software architectures to link your Simulink® export-function, rate-based, or JMAAB models to components in your architecture model to simulate and generate code.

These are relevant concepts for software architecture workflows:

  • A software architecture is a specialization of an architecture for software-based systems, including the description of software compositions, component functions, and their scheduling.

    Use software architectures in System Composer to author software architecture models composed of software components, ports, and interfaces. Design your software architecture model, define the execution order of your component functions, simulate your design in the architecture level, and generate code.

  • A software component is a specialization of a component for software entities, including its interfaces.

    Implement a Simulink export-function, rate-based, or JMAAB model as a software component, simulate the software architecture model, and generate code.

  • A software composition is a diagram of software components and connectors that represents a composite software entity, such as a module or application.

    Encapsulate functionality by aggregating or nesting multiple software components or compositions.

Create New Software Architecture Model

The workflow for authoring software architecture models is similar to authoring system architectures. Start with a blank software architecture template to model.

You can create a software architecture programmatically by using the function.

systemcomposer.createModel("mySoftwareArchitectureDesign","SoftwareArchitecture")

where mySoftwareArchitectureDesign is the name of the new model.

You can also use the provided template in the Simulink start page.

Select Software Architecture Model.

Software architecture template in Simulink start page

System Composer provides template architecture models that address different domains in systems engineering and software architecture modeling: Architecture Model and Software Architecture Model. All architecture models provide the same structural capabilities with some domain and platform specific constraints. For more information on architecture templates, see Choose Architecture Template for System Design.

From a Simulink model or a System Composer architecture model, on the Simulation tab, select New New model, and then select Architecture . Then, select Software Architecture Model.

System Composer opens a new empty software architecture model. Observe the icon on the upper left corner that distinguishes the empty model from a system architecture.

Empty software architecture model

When you model software architectures, you can:

Build a Simple Software Architecture Model

  1. Drag an empty component to the mySoftwareArchitectureDesign model.

    Added component to a software architecture

  2. Link this simple Simulink Export-Function model, export_model_software_architecture to your component by right-clicking the component and selecting Link to Model. For more information about building this Simulink model, see Create Export-Function Model.

    Simulink Export-Function model

  3. Connect component input port and output ports to architecture input ports and output ports.

    Software architecture with a component linked to an Export-Function model.

In this example, you start from a blank template and create a simple software architecture model. To learn how to simulate a software architecture model and generate code, see Simulate and Deploy Software Architectures.

Import and Export Software Architectures

You can import a software architecture model using the systemcomposer.importModel function.

archModel = systemcomposer.importModel(modelName,importStruct)

If the domain field of importStruct is "Software", the importModel function creates a new software architecture based on the structure of the MATLAB® tables.

To export a System Composer software architecture model, use the systemcomposer.exportModel function.

exportedSet = systemcomposer.exportModel(modelName)

The exportModel function returns a structure containing MATLAB tables that contains components, ports, connections, portInterfaces, requirementLinks, and a domain field with value 'Software' to indicate that the exported architecture is a software architecture.

For more information on importing and exporting software architectures with functions, see Import and Export Functions of Software Architectures.

Export Architecture to Software Architecture

Create Software Architecture Model from Component

You can create a software architecture model from an existing component in a System Composer architecture model.

To create a software architecture model from a component:

  1. Select an existing component from your architecture model. In this example, Component2 is selected.

    Architecture model with two components, Component1 and Component2

  2. To create a software architecture model from Component2, you can use any of these three methods:

    1. Right-click the component and select Create Software Architecture Model.

    2. Select the component and, on the toolstrip, click Create Software Architecture Model.

      Create Software Architecture button in the toolstrip.

    3. To create a software architecture programmatically, use the createArchitectureModel function.

  3. Observe the software architecture model icon in the upper left corner. The new software architecture contains all elements from the component, including previously applied stereotypes.

    Software architecture model icon on the upper left corner.

Export Architecture to Software Architecture Model

To export your model to a software architecture, use one of these methods:

  • In the toolstrip, on the Simulation tab, click the Save button arrow, then select a model type.

    Save drop-down menu with emphasis on the Export Model To section.

    Once you select model type, you can specify the New model name and the Destination folder.

  • Export your model programmatically using the systemcomposer.exportToSoftwareArchitecture function.

Software Architecture Constraints and Limitations

The benefit of using the Software Architecture template is the application of software domain specific constraints. To allow for the completion of the model-based design workflow, the template does not support the use of these elements:

  • Adapter blocks with UnitDelay or RateTransition as the applied interface conversion. The applied interface conversion changes to None for these Adapter blocks.

  • Physical ports.

Some model elements are not supported in the software architecture model template. These elements include:

  • A component with Stateflow® chart behavior.

  • A Reference Component block linked to a Simulink subsystem, subsystem reference, or model containing an FMU block.

Note

For more information regarding saving a component or architecture as an AUTOSAR architecture, see Create AUTOSAR Architecture from System Composer Model (AUTOSAR Blockset).

See Also

| |

Related Topics