systemcomposer.allocation.AllocationSet
Description
An AllocationSet
object defines a collection of allocation
scenarios between two System Composer™ models.
Creation
Create an allocation set with name myNewAllocation
using the systemcomposer.allocation.createAllocationSet
function.
systemcomposer.allocation.createAllocationSet("myNewAllocation", ... "Source_Model_Allocation","Target_Model_Allocation");
Properties
Name
— Name of allocation set
character vector
Name of allocation set, specified as a character vector.
Example: 'MyNewAllocation'
Data Types: char
SourceModel
— Source model for allocation
model object
Source model for allocation, specified as a systemcomposer.arch.Model
object.
TargetModel
— Target model for allocation
model object
Target model for allocation, specified as a systemcomposer.arch.Model
object.
Scenarios
— Allocation scenarios
array of allocation scenario objects
Allocation scenarios, specified as an array of systemcomposer.allocation.AllocationScenario
objects.
Description
— Description of allocation set
character vector
Description of allocation set, specified as a character vector.
Data Types: char
DefaultStereotype
— Name of default stereotype to apply to allocations in allocation set
character vector | string
Name of default stereotype to apply to allocations in allocation set, specified in
the form "<profile>.<stereotype>"
. The profile must already be
imported into the allocation set.
Data Types: char
| string
NeedsRefresh
— Whether allocation set is out of date
1
(true
) | 0
(false
)
Whether allocation set is out of date with the source model, target model, or both,
specified as 1
(true
) or 0
(false
).
Data Types: logical
Dirty
— Whether allocation has unsaved changes
1
(true
) | 0
(false
)
Whether allocation set has unsaved changes, specified as 1
(true
) or 0
(false
).
Data Types: logical
UUID
— Universal unique identifier
character vector
Universal unique identifier, specified as a character vector.
Example: '91d5de2c-b14c-4c76-a5d6-5dd0037c52df'
Data Types: char
Object Functions
applyProfile | Apply profile to model |
removeProfile | Remove profile from model |
createScenario | Create new empty allocation scenario |
getScenario | Get allocation scenario |
deleteScenario | Delete allocation scenario |
synchronizeChanges | Synchronize changes of models in allocation set |
find | Find loaded allocation set |
save | Save allocation set as file |
rebindSourceModel | Change source model |
rebindTargetModel | Change target model |
close | Close allocation set |
closeAll | Close all open allocation sets |
Examples
Allocate Architectures in Tire Pressure Monitoring System
Use allocations to analyze a tire pressure monitoring system.
Overview
In systems engineering, it is common to describe a system at different levels of abstraction. For example, you can describe a system in terms of its high-level functions. These functions may not have any behavior associated with them but most likely trace back to some operating requirements the system must fulfill. We refer to this layer (or architecture) as the functional architecture. In this example, an automobile tire pressure monitoring system is described in three different architectures:
Functional Architecture — Describes the system in terms of its high-level functions. The connections show dependencies between functions [1].
Logical Architecture — Describes the system in terms of its logical components and how data is exchanged between them. Additionally, this architecture specifies behaviors for model simulation [2].
Platform Architecture — Describes the physical hardware needed for the system at a high level [3].
Note: This example illustrates allocations in System Composer™ using a specific methodology. However, you can use other methodologies that fit your needs.
The allocation process is defined as linking these three architectures that fully describe the system. The linking captures the information about each architectural layer and makes it accessible to the others.
Use this command to open the project.
openProject("scExampleTirePressureMonitorSystem");
Open the FunctionalAllocation.mldatx
file, which displays allocations from TPMS_FunctionalArchitecture
to TPMS_LogicalArchitecture
in the Allocation Editor. The elements of TPMS_FunctionalArchitecture
are displayed in the first column. The elements of TPMS_LogicalArchitecture
are displayed in the first row. The arrows indicate the allocations between model elements.
The arrows display allocated components in the model. You can observe allocations for each element in the model hierarchy.
The rest of the example shows how to use this allocation information to further analyze the model.
Functional to Logical Allocation and Coverage Analysis
This section shows how to perform coverage analysis to verify that all functions have been allocated. This process requires using the allocation information specified between the functional and logical architectures.
To start the analysis, load the allocation set.
allocSet = systemcomposer.allocation.load('FunctionalAllocation');
scenario = allocSet.Scenarios;
Verify that each function in the system is allocated.
import systemcomposer.query.*; [~,allFunctions] = allocSet.SourceModel.find(HasStereotype(IsStereotypeDerivedFrom("TPMSProfile.Function"))); unAllocatedFunctions = []; ImplementedAllocations = []; for i = 1:numel(allFunctions) alloc = scenario.getAllocatedTo(allFunctions(i)); if isempty(alloc) unAllocatedFunctions(end+1) = allFunctions(i); end end allCompsSource = allocSet.SourceModel.find(AnyComponent); allCompsTarget = allocSet.TargetModel.find(AnyComponent); for i = 1:numel(allCompsSource) for j = 1:numel(allCompsTarget) sourceComp = allocSet.SourceModel.lookup(Path=allCompsSource{i}); targetComp = allocSet.TargetModel.lookup(Path=allCompsTarget{j}); allocated = scenario.getAllocation(sourceComp,targetComp); if ~isempty(allocated) if allocated.getPropertyValue("TPMSProfile.FunctionalAllocation.IsImplemented") ImplementedAllocations(end+1) = strcat(sourceComp.Name," to ",targetComp.Name); end end end end if isempty(unAllocatedFunctions) fprintf('All functions are allocated'); else fprintf('%d Functions have not been allocated',numel(unAllocatedFunctions)); end
All functions are allocated
if isempty(ImplementedAllocations) fprintf('No allocations are implemented'); else fprintf('%d Allocations have been implemented',numel(ImplementedAllocations)); end
6 Allocations have been implemented
The result displays All functions are allocated
to verify that all functions in the system are allocated and lists the allocations that have not been implemented.
Analyze Suppliers Providing Functions
This section shows how to identify which functions will be provided by which suppliers using the specified allocations. Since suppliers will be delivering these components to the system integrator, the supplier information is stored in the logical model.
suppliers = {'Supplier A','Supplier B','Supplier C','Supplier D'}; functionNames = arrayfun(@(x) x.Name, allFunctions,'UniformOutput',false); numFunNames = length(allFunctions); numSuppliers = length(suppliers); allocTable = table('Size',[numFunNames,numSuppliers],'VariableTypes',... repmat("double",1,numSuppliers)); allocTable.Properties.VariableNames = suppliers; allocTable.Properties.RowNames = functionNames; for i = 1:numFunNames elem = scenario.getAllocatedTo(allFunctions(i)); for j = 1:numel(elem) elemSupplier = getEvaluatedPropertyValue(elem(j),"TPMSProfile.LogicalComponent.Supplier"); allocTable{i,strcmp(elemSupplier,suppliers)} = 1; end end
The table shows which suppliers are responsible for the corresponding functions.
allocTable
allocTable=8×4 table
Supplier A Supplier B Supplier C Supplier D
__________ __________ __________ __________
Calculate Tire Pressure 0 1 0 0
Measure rotations 0 1 0 0
Measure temprature of tire 0 0 0 1
Report Low Tire Pressure 1 0 0 0
Calculate if pressure is low 1 0 0 0
Measure pressure on tire 0 0 1 0
Report Tire Pressure Levels 1 0 0 0
Measure Tire Pressure 0 0 0 0
Analyze Software Deployment Strategies
You can determine if the Engine Control Unit (ECU) has enough capacity to house all the software components. The software components are allocated to the cores themselves, but the ECU is the component that has the budget property.
Get the platform architecture.
platformArch = systemcomposer.loadModel('PlatformArchitecture');
Load the allocation.
softwareDeployment = systemcomposer.allocation.load('SoftwareDeployment'); frontECU = platformArch.lookup('Path','PlatformArchitecture/Front ECU'); rearECU = platformArch.lookup('Path','PlatformArchitecture/Rear ECU'); scenario1 = softwareDeployment.getScenario('Scenario 1'); scenario2 = softwareDeployment.getScenario('Scenario 2'); frontECU_availMemory = getEvaluatedPropertyValue(frontECU,"TPMSProfile.ECU.MemoryCapacity"); rearECU_availMemory = getEvaluatedPropertyValue(rearECU,"TPMSProfile.ECU.MemoryCapacity"); frontECU_memoryUsed1 = getUtilizedMemoryOnECU(frontECU,scenario1); frontECU_isOverBudget1 = frontECU_memoryUsed1 > frontECU_availMemory; rearECU_memoryUsed1 = getUtilizedMemoryOnECU(rearECU,scenario1); rearECU_isOverBudget1 = rearECU_memoryUsed1 > rearECU_availMemory; frontECU_memoryUsed2 = getUtilizedMemoryOnECU(frontECU,scenario2); frontECU_isOverBudget2 = frontECU_memoryUsed2 > frontECU_availMemory; rearECU_memoryUsed2 = getUtilizedMemoryOnECU(rearECU,scenario2); rearECU_isOverBudget2 = rearECU_memoryUsed2 > rearECU_availMemory;
Build a table to showcase the results.
softwareDeploymentTable = table([frontECU_memoryUsed1;frontECU_availMemory;... frontECU_isOverBudget1;rearECU_memoryUsed1;rearECU_availMemory;rearECU_isOverBudget1],... [frontECU_memoryUsed2; frontECU_availMemory; frontECU_isOverBudget2;rearECU_memoryUsed2;... rearECU_availMemory; rearECU_isOverBudget2],... 'VariableNames',{'Scenario 1','Scenario 2'},... 'RowNames',{'Front ECUMemory Used (MB)','Front ECU Memory (MB)','Front ECU Overloaded',... 'Rear ECU Memory Used (MB)','Rear ECU Memory (MB)','Rear ECU Overloaded'})
softwareDeploymentTable=6×2 table
Scenario 1 Scenario 2
__________ __________
Front ECUMemory Used (MB) 110 90
Front ECU Memory (MB) 100 100
Front ECU Overloaded 1 0
Rear ECU Memory Used (MB) 0 20
Rear ECU Memory (MB) 100 100
Rear ECU Overloaded 0 0
function memoryUsed = getUtilizedMemoryOnECU(ecu, scenario)
For each component in the ECU, accumulate the binary size required for each allocated software component.
coreNames = {'Core1','Core2','Core3','Core4'}; memoryUsed = 0; for i = 1:numel(coreNames) core = ecu.Model.lookup('Path',[ecu.getQualifiedName '/' coreNames{i}]); allocatedSWComps = scenario.getAllocatedFrom(core); for j = 1:numel(allocatedSWComps) binarySize = getEvaluatedPropertyValue(allocatedSWComps(j),"TPMSProfile.SWComponent.BinarySize"); memoryUsed = memoryUsed + binarySize; end end end
More About
Definitions
Term | Definition | Application | More Information |
---|---|---|---|
allocation | An allocation establishes a directed relationship from architectural elements — components, ports, and connectors — in one model to architectural elements in another model. | Resource-based allocation allows you to allocate functional architectural elements to logical architectural elements and logical architectural elements to physical architectural elements. | |
allocation scenario | An allocation scenario contains a set of allocations between a source and a target model. | Allocate between model elements in an allocation scenario. The
default allocation scenario is called | Systems Engineering Approach for SoC Applications |
allocation set | An allocation set consists of one or more allocation scenarios that describe various allocations between a source and a target model. | Create an allocation set with allocation scenarios in the Allocation Editor. Allocation sets are saved as MLDATX files. |
Version History
Introduced in R2020b
See Also
Tools
Blocks
Objects
Functions
systemcomposer.allocation.createAllocationSet
|systemcomposer.allocation.load
|systemcomposer.allocation.open
|systemcomposer.allocation.editor
|close
|systemcomposer.allocation.AllocationSet.closeAll
|systemcomposer.allocation.AllocationSet.find
|save
|rebindSourceModel
|rebindTargetModel
|synchronizeChanges
|createScenario
|deleteScenario
|getScenario
|allocate
|deallocate
|getAllocation
|getAllocatedFrom
|getAllocatedTo
|destroy
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)