When I was in school, I always felt that automatic code generation was not very reliable and I used it too. At that time, I found that the names of automatically generated code variables were chaotic and I was basically not interested. After work, I used Automatic code generation to find that this is a one-to-one tool.
The advantages of Automatic code generation are:
1) Graphical policy modeling is very helpful for communication;
2) Policy engineers do not need to have rich programming experience;
3) The quality of automatically generated code is relatively high, at least in terms of security, it is higher than that of manual coding;
4) generally, the model is a fixed-point model with better computing efficiency. Therefore, it has advantages in the fixed-point model;
5) model testing is easier than code testing.
The Simulink Automatic Code uses the MPT object to describe the parameters and signals (calibration and measurement), and the simulink. numerictype to describe the data type. MPT object describes some basic attributes of parameters and Signals: data type, initial value, and options related to Automatic Code Generation. Simulink. numerictype is mainly used to describe the data type of a specified point, that is, the data definition, scaling factor, and offset. Generally, a data dictionary is used to describe the data type. Everyone in a project shares a set of data dictionaries. After setting the attributes of the MPT object, convert the model from floating point to fixed point, and set the model to automatically generate attributes, the code can be automatically generated.
Complete the detailed process.