How to change ‘XmlOptions' opertions(Compnent Package name) by programmatically

2 views (last 30 days)
I wanna change Simulink model to AUTOSAR property by programmatically. When I use AUTOSAR funntion(autosar.api.getAUTOSARProperties),something wrrong was happan. How can I to fix it by program way.
if true
% Open model
hModel = 'Add';
open_system(hModel);
autosar.api.create(hModel)
% Use AUTOSAR property functions
arProps = autosar.api.getAUTOSARProperties(hModel);
%Add AUTOSAR S-R interface
addPackageableElement(arProps, 'SenderReceiverInterface','/ApplicationLayer/ApplicationPackage/test_Add/SR_Interface/Add/Output',... 'if_out'); addPackageableElement(arProps, 'SenderReceiverInterface','/ApplicationLayer/ApplicationPackage/test_Add/SR_Interface/Add/Input',... 'if_in'); ifPaths = find(arProps, [], 'SenderReceiverInterface', 'PathType', 'FullyQualified');
%Add AUTOSAR S-R data Element(Sender Ports Element) add(arProps, 'if_out', 'DataElements', 'out');
%Add AUTOSAR S-R data Elememt(Receiver Ports Element) add(arProps, 'if_in', 'DataElements', 'In1'); add(arProps, 'if_in', 'DataElements', 'In2');
aswcPath = find(arProps,[],'AtomicComponent','PathType','FullyQualified');
% Add AUTOSAR receiver and sender ports with S-R interface name
add(arProps, aswcPath{1}, 'SenderPorts', 'test_out', 'Interface', 'if_out'); add(arProps, aswcPath{1}, 'ReceiverPorts', 'test_in1', 'Interface', 'if_in'); add(arProps, aswcPath{1}, 'ReceiverPorts', 'test_in2', 'Interface', 'if_in');
% Use AUTOSAR map functions slMap=autosar.api.getSimulinkMapping(hModel);
% Map Simulink inport to AUTOSAR receiver port rDataAccessMode = 'ImplicitReceive'; mapInport(slMap,'In1','test_in1','In1',rDataAccessMode);
mapInport(slMap,'In2','test_in2','In2',rDataAccessMode);
% Map Simulink outport to AUTOSAR sender port sDataAccessMode = 'ImplicitSend'; mapOutport(slMap,'Out1','test_out','out',sDataAccessMode);
%get(arProps,'XmlOptions','ComponentQualifiedName'); %set(arProps, 'XmlOptions', '/ApplicationLayer/ApplicationPackage/test_Add/Component') %set(arProps,'XmlOptions','ApplicationDataTypePackage','/rtwdemo_autosar_counter_pkg/ADTs');
% Find AUTOSAR runnables %swc = get(arProps,'XmlOptions','ComponentQualifiedName'); %ib = get(arProps,swc,'Behavior'); %%runnables = find(arProps,ib,'Runnable','PathType','FullyQualified')
%RunnablePaths = find(arProps, [], 'ApplicationComponentBehavior', 'PathType','FullyQualified');
%Add AUTOSAR Runnables %add(arProps, RunnablePaths{1}, 'Runnables', 'AddMain') %add(arProps, RunnablePaths{1}, 'Runnables', 'Add_Init')
%TimingEventPaths = find(arProps, [], 'TimingEvent', 'PathType', 'FullyQualified') %add(arProps, RunnablePaths{1}, 'Events', 'AddMain_timingEvent')
end

Answers (0)

Categories

Find more on AUTOSAR Blockset in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!