how to convert autosar parameters to constant

4 visualizaciones (últimos 30 días)
HWASUB LEE
HWASUB LEE el 8 de Sept. de 2020
Comentada: Ethan Wu el 18 de Feb. de 2021
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'?

Respuestas (1)

Ethan Wu
Ethan Wu el 8 de Feb. de 2021
Editada: Ethan Wu el 8 de Feb. de 2021
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 comentario
Ethan Wu
Ethan Wu el 18 de Feb. de 2021
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

Iniciar sesión para comentar.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by