报错如图显示,外部定义的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];