how to convert autosar parameters to constant
조회 수: 4 (최근 30일)
이전 댓글 표시
I need to convert calibration parameters to constant, or vice versa.
Here is one example of parameter which I want to convert to constant.
what is the stable way to convert calibration to constant, which cant be affected by any of code generation configuration in matlab?
CalParm_test = AUTOSAR.Parameter;
CalParm_test.Value = 50;
CalParm_test.CoderInfo.StorageClass = 'Custom';
CalParm_test.CoderInfo.Alias = '';
CalParm_test.CoderInfo.Alignment = -1;
CalParm_test.CoderInfo.CustomStorageClass = 'InternalCalPrm';
CalParm_test.CoderInfo.CustomAttributes.PerInstanceBehavior = 'Parameter shared by all instances of the Software Component';
CalParm_test.SwCalibrationAccess = 'ReadWrite';
CalParm_test.Description = '';
CalParm_test.DataType = 'single';
CalParm_test.Min = -20000;
CalParm_test.Max = 20000;
CalParm_test.DocUnits = '-';
When I change it as 'Auto', parameter will be generated as inline constant value without variable.
What is the difference to confidure StorageClass as 'Custom' and 'Auto'?
댓글 수: 0
답변 (1개)
Ethan Wu
2021년 2월 8일
편집: Ethan Wu
2021년 2월 8일
When you mapping AUTOSAR ,You can try map CalParm_test to ConstantMemory,maybe you will get what you want.And actualluy,when you mapping AUTOSAR and set CalParm_test to Auto,the calibration will be its value in the generated code(just like picture). And when I set CalParm_test to SharedParameter,sometimes I will also find parameter will be generated as inline constant value without variable.But sometimes I can find its value in the Data files( if it can generate this file) ,so I think maybe there is something wrong when you mapping AUTOSAR(I'm not sure).In fact ,if you use MATLAB2020a,the parameter will be valued when defined. And I also want to know what's the defference when I set CalParm_test.CoderInfo.CustomStorageClass = 'InternalCalPrm' or 'CalPrm'? I don't find any difference while I read the generated code.But when I read MATLAB document,I think there should be some difference.......
댓글 수: 1
Ethan Wu
2021년 2월 18일
If you use matlab2020a,you can search PerInstanceParameter,and you will get difference between shared and Per-Instance. And we don't have to set parameter's StorageClass, we just
Configure AUTOSAR Shared or Per-Instance Parameters
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!