addPort
Add port to AUTOSAR component, parameter component, composition, or architecture model
Description
adds one or more ports specified by ports
= addPort(archElementOrModel
,portKind
,portNames
)portNames
of type
portKind
to the component, parameter software component, composition,
or architecture model represented by archElementOrModel
.
Examples
Create an AUTOSAR Blockset architecture model and programmatically add an AUTOSAR composition named
Sensors
to the canvas.
By default, autosar.arch.createModel
creates an AUTOSAR architecture model for the
Classic Platform. Using adaptive components in an AUTOSAR Classic Platform architecture
model is not supported.
modelName = "myArchModel"; archModel = autosar.arch.createModel(modelName); composition = addComposition(archModel,"Sensors");
At the top level of the model, add an application component named
Controller1
and a sensor-actuator component named
Actuator
.
addComponent(archModel,"Controller1"); actuator = addComponent(archModel,"Actuator"); set(actuator,Kind="SensorActuator");
For the architecture model, add two receiver (input) ports and one sender (output) port. The ports appear at the architecture model boundary.
addPort(archModel,"Receiver",["TPS_Hw","APP_Hw"]); addPort(archModel,"Sender","ThrCmd_Hw");
For the composition block, add two receiver ports and two sender ports. The composition receiver port names match the names of the architecture model receiver ports to which they connect.
addPort(composition,"Receiver",{"TPS_Hw","APP_Hw"}); addPort(composition,"Sender",{"TPS_Perc","APP_Perc"});
For the component blocks, add receiver and sender ports. The component receiver and sender port names match the names of the component, composition, or architecture model ports to which they connect.
controller = find(archModel,"Component",Name="Controller1"); addPort(controller,"Receiver",{"TPS_Perc","APP_Perc"}); addPort(controller,"Sender","ThrCmd_Perc"); addPort(actuator,"Receiver","ThrCmd_Perc"); addPort(actuator,"Sender","ThrCmd_Hw"); layout(archModel);
Create an AUTOSAR Blockset architecture model, and programmatically add an AUTOSAR composition named
Sensors
to the canvas.
By default, autosar.arch.createModel
creates an AUTOSAR architecture model for the
Classic Platform. Specify the platform
as
Adaptive
to create an AUTOSAR Adaptive Platform architecture model.
Using classic components in an AUTOSAR Adaptive Platform architecture model is not
supported.
modelName = "myArchAdaptive"; archModel = autosar.arch.createModel(modelName,platform="Adaptive"); composition = addComposition(archModel,"Sensors");
At the top level of the model, add an adaptive application component named
Filter
. For the Adaptive Platform components, the component type is
AdaptiveApplication
.
addComponent(archModel,"Filter");
For the architecture model, add two receiver (input) ports and two sender (output) ports. The ports appear at the architecture model boundary.
addPort(archModel,"Receiver",{"Data_Snsr1","Data_Snsr2"}); addPort(archModel,"Sender",{"FilteredData_Snsr1","FilteredData_Snsr2"});
For the composition block, add two receiver ports and two sender ports. The composition receiver port names match the names of the architecture model receiver ports to which they connect.
Also on the composition block, add a client port.
addPort(archModel,"Receiver",{"Data_Snsr1","Data_Snsr2"}); addPort(composition,"Sender",... {"FilteredData_Snsr1","FilteredData_Snsr2"}); addPort(composition,"Client","Filter_CSPort");
For the component block, add a server port. The component server port name matches the name of the component, composition, or architecture model ports to which it connects.
filter = find(archModel,"Component","Name","Filter"); addPort(filter,"Server","Filter_CSPort"); layout(archModel);
Create an AUTOSAR Blockset architecture model.
modelName = "myArchModel";
archModel = autosar.arch.createModel(modelName);
Add a parameter component, and an AUTOSAR Classic component.
addComponent(archModel,"ParameterComponent",... Kind="ParameterComponent"); addComponent(archModel,"Controller1");
Add ports to the architecture and AUTOSAR Classic component.
addPort(archModel,"Receiver",{"TPS_Hw","APP_Hw"}); addPort(archModel,"Sender","ThrCmd_Hw"); controller = find(archModel,"Component",Name="Controller1"); addPort(controller,"Receiver",{"TPS_Perc","APP_Perc"}); addPort(controller,"Sender","ThrCmd_Perc");
Add parameter sender ports to the AUTOSAR parameter software component. Connections are automatically created between parameter sender and parameter receiver ports with matching port and appear only in generated ARXML files.
parameterComponent = find(archModel,"ParameterComponent"); addPort(parameterComponent,"ParameterSender","Param_SPort");
... <CONNECTORS> <ASSEMBLY-SW-CONNECTOR UUID="bcdfdb40-a9ee-5e0b-2389-caf35247273b"> <SHORT-NAME>ParameterProvider_ParameterPort_SensorComponent_ParameterPort</SHORT-NAME> <PROVIDER-IREF> <CONTEXT-COMPONENT-REF DEST="SW-COMPONENT-PROTOTYPE">/Components/AUTOSARArchitecture/ParameterProvider</CONTEXT-COMPONENT-REF> <TARGET-P-PORT-REF DEST="P-PORT-PROTOTYPE">/Components/ParameterProvider/ParameterPort</TARGET-P-PORT-REF> </PROVIDER-IREF> <REQUESTER-IREF> <CONTEXT-COMPONENT-REF DEST="SW-COMPONENT-PROTOTYPE">/Components/AUTOSARArchitecture/SensorComponent</CONTEXT-COMPONENT-REF> <TARGET-R-PORT-REF DEST="R-PORT-PROTOTYPE">/Components/ASWC/ParameterPort</TARGET-R-PORT-REF> </REQUESTER-IREF> </ASSEMBLY-SW-CONNECTOR> ...
Input Arguments
AUTOSAR component, parameter software component, composition, or architecture model to add one or more ports to.
Components are specified as
autosar.arch.Component
objects, returned by theaddComponent
function.Compositions are specified as
autosar.arch.Composition
objects, returned by theaddComposition
function.Architecture models are specified as
autosary.arch.Model
objects, returned by either of theautosar.arch.createModel
orautosar.arch.loadModel
functions.
Example: archModel
Type of AUTOSAR ports to add to the specified component, composition, or architecture model. The specified type applies to all added ports.
For AUTOSAR Classic and Adaptive Platform components the valid port types are:
"Receiver"
"Sender"
"Client"
"Server"
For AUTOSAR Classic Platform parameter software components the only valid
port type is "ParameterSender"
.
Example: 'Receiver'
Names of the ports to add to the specified component, composition, or architecture model, specified as a character vector or string scalar for a single name, or a cell array of character vector or string array for multiple names.
Example: ["TPS_Hw","APP_Hw"]
Example: {'TPS_Hw','APP_Hw'}
Output Arguments
One or more AUTOSAR ports, returned as an autosar.arch.CompPort
,
autosar.arch.ArchPort
, or autosar.arch.ParameterPort
object or an array of port objects and their
properties.
Version History
Introduced in R2020aAdd parameter software components to AUTOSAR architecture models by using the addComponent
function. Add parameter ports to the parameter software components by using the
addPort
function and specifying the parameter software component
object. Generate ARXML files containing the parameter software components and ports.
Connectors are generated in the ARXML and are created between ports with the same
name.
R2023a introduces AUTOSAR architecture modeling for the Adaptive Platform. Client and
Server ports are added to the available portKind
ports and supported for
modeling method communication in an AUTOSAR adaptive architecture.
See Also
addComponent
| addComposition
| connect
| destroy
| importFromARXML
| layout
| find
Topics
- Configure AUTOSAR Port Parameters for Communication with Parameter Software Component
- Configure AUTOSAR Architecture Model Programmatically
- Add and Connect AUTOSAR Classic Components and Compositions
- Add and Connect AUTOSAR Adaptive Components and Compositions
- Author AUTOSAR Compositions and Components in Architecture Model
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)