What are the "Real-Time Model" objects for in simple code generated by embedded coder

조회 수: 6 (최근 30일)
I have gotten a really simple model (just multiplication of 2 values) and have been able to autogenerate the Step function using the embedded coder. When I examine the code that is generated it is relatively good but there are a couple of “real-time model” variables that are never used in the functions that are defined. I was wondering what these are being generated for. I really only expected to get the .step function with the single multiply and don’t need this extra overhead or code in the generated source. The lines in question are in bold below.
/*
* File: MultiplyVals.c
*
/* Real-time model */
*RT_MODEL_MultiplyVals MultiplyVals_M_;
RT_MODEL_MultiplyVals *const MultiplyVals_M = &MultiplyVals_M_;*
/* Model step function */
void untitled_custom(real_T *arg_In1, real_T *arg_In2, real_T *arg_Out1)
{
/* Outport: '<Root>/Out1' incorporates:
* Inport: '<Root>/In1'
* Inport: '<Root>/In2'
* Product: '<Root>/Product'
*/
*arg_Out1 = *arg_In1 * *arg_In2;
}

채택된 답변

Babak
Babak 2012년 8월 8일
extra code is generated according to the "Configuration Parameter"'s setting. For example, Go to the Interface pane and check if you have checkmarks for absolute, complex numbers,...
  댓글 수: 2
Chris
Chris 2012년 8월 9일
That is essentially where I found my final solution: In Configuration Parameters -> Code Generation -> Interface there is a checkbox labeled "Suppress error status in real-time model data structure.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Kaustubha Govind
Kaustubha Govind 2012년 8월 9일
Are you using anything other than a plain Multiply block in your model? Model references, S-functions, etc.? Also, do you use ert.tlc as the System Target file, or something else? If you're not using any of these, it might be worth reporting this to MathWorks Tech Support with the reproduction model.

Chris
Chris 2012년 8월 9일
Thanks for your guys help. I actually ended up finding out the solution to my question by continuing to work through the Simulink Coder Options boxs. In Configuration Parameters -> Code Generation -> Interface there is a checkbox labeled "Suppress error status in real-time model data structure. As soon as I checked this box those useless objects were removed from the generated code.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by