Replacing an Included Component
Projects and several components (i.e. modules, classes, AUTOSAR software components, state machines) can contain other components.
In the Outline tab of the project or component editor, select the included component you want to replace.
Note
You can replace missing components (shown as
), but for them, neither block diagram connections nor process assignments to tasks can be restored automatically.Do one of the following.
- Open the Edit menu and select Replace Component.
- Open the context menu of the included component and select Replace Component.
If the parent component contains unsaved changes, you are asked whether you want to store the changes.
Click Yes to continue.
The Select Item dialog window opens. It shows the content of the current database/workspace.
From the "Database" or "Workspace" list, select the component you want to use as replacement.
The selected component must be of the same type as the one you want to replace. A module must be replaced with another module, an SWC must be replaced with an SWC, a class with a class, etc.
The type of a missing component cannot be determined. In that case, the system checks whether the selected replacement component is allowed in the parent component.
Click OK to perform the replacement.
If an invalid component was selected for replacement, the following message opens, and the procedure is canceled after you confirmed the message with OK.
<replacement component> cannot be used within <parent component>
If a valid component was selected for replacement, you are asked if you want to replace the selected occurrence or all occurrences of the included component.
Continue with All or Selected.
If you chose All, a warning opens that recursive replacement (i.e. replacing all component occurrences in the current component) is not recommended because type consistency cannot be guaranteed. You are asked whether you want to replace the component recursively, nevertheless.
Answer the question with Yes (all component instances in the project contest are replaced), No (only the current instance is replaced) or Cancel.
The new component replaces the old component.
In a block diagram, existing connections are restored if the new component contains pins (i.e. the interface elements) with identical names as the old component.
Note
The type of the new component's pins is not checked; you must remove illegal (e.g., between log and cont) and non-matching (e.g., between cont and limitInt) connections manually.
In a project, process assignments to tasks are restored if the new module contains processes with identical names as the old module.
See also