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!