Mtalab 2022b进行Aut​osar建模时,Co​deMapping环​节报错:自定义的全局​变量定义Storag​eClass 冲突

4 views (last 30 days)
报错如图显示,外部定义的StorageClass与模型中定义的StorageClass冲突,其中,Runnable设置SwAddresMethord为None;
自定义的StorageClass如下:
1、模型配置参数设置:SwAddresMethord,已添加了 CODE、MeasSig:
cs.set_param('MemSecFuncSharedUtil', 'CODE'); % Memory section for shared utility functions
cs.set_param('MemSecFuncInitTerm', 'CODE'); % Memory section for initialize/terminate functions
cs.set_param('MemSecFuncExecute', 'CODE'); % Memory section for execution functions
cs.set_param('MemSecDataParameters', 'Default'); % Memory section for parameters
cs.set_param('MemSecDataInternal', 'CODE'); % Memory section for internal data
cs.set_param('MemSecDataIO', 'Default'); % Memory section for inputs/outputs
cs.set_param('MemSecDataConstants', 'Default'); % Memory section for constants %
2、在csc_registration.m中定义MeasSig:
h = Simulink.CSCDefn;
set(h, 'Name', 'MeasSig');
set(h, 'OwnerPackage', 'AUTOSAR4');
set(h, 'CSCType', 'Unstructured');
set(h, 'MemorySection', 'Default');
set(h, 'IsMemorySectionInstanceSpecific', true);
set(h, 'IsGrouped', false);
set(h.DataUsage, 'IsParameter', false);
set(h.DataUsage, 'IsSignal', true);
set(h, 'DataScope', 'Exported');
set(h, 'IsDataScopeInstanceSpecific', false);
set(h, 'IsAutosarPerInstanceMemory', true);
set(h, 'IsAutosarPostBuild', false);
set(h, 'SupportSILPIL', false);
set(h, 'DataInit', 'None');
set(h, 'IsDataInitInstanceSpecific', false);
set(h, 'DataAccess', 'Direct');
set(h, 'IsDataAccessInstanceSpecific', false);
set(h, 'HeaderFile', '');
set(h, 'IsHeaderFileInstanceSpecific', true);
set(h, 'DefinitionFile', '');
set(h, 'IsDefinitionFileInstanceSpecific', true);
set(h, 'Owner', '');
set(h, 'IsOwnerInstanceSpecific', true);
set(h, 'PreserveDimensions', false);
set(h, 'PreserveDimensionsInstanceSpecific', false);
set(h, 'IsReusable', false);
set(h, 'IsReusableInstanceSpecific', false);
set(h, 'CommentSource', 'Default');
set(h, 'TypeComment', '');
set(h, 'DeclareComment', '');
set(h, 'DefineComment', '');
set(h, 'CSCTypeAttributesClassName', '');
set(h, 'CSCTypeAttributes', []);
set(h, 'TLCFileName', 'Unstructured.tlc');
defs = [defs; h];

Accepted Answer

Lei
Lei on 30 Apr 2025
I resolved this problem via reading all Signals inthe model and mapping to auto
mapSignal(slMap,outportHandle(ii),'Auto')
mapDataStore(slMap,DataStoreInUse{i,2},'Auto');

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!