Borrar filtros
Borrar filtros

How to determine the sequence of generated code?

3 visualizaciones (últimos 30 días)
Bo Zhou
Bo Zhou el 27 de Oct. de 2019
Respondida: Dinesh Yadav el 30 de Oct. de 2019
I have develop my own TLC file to generate C code.
In my own TLC, there are:
%function Outputs(block, system) Output
%if (CompiledModel.ConfigSet.SystemTargetFile == "GW_RCP.tlc")
%assign ECUOutputNum = enuRelay6Ctrl
%<ECUOutput>= %<LibBlockInputSignal(0,"","",0)> ;
%endif
%endfunction
In the generated code, the codes are:
/* S-Function (rcp_ecu_output): '<Root>/ECU_Output' */
enuRelay6Ctrl = Output ;
/* S-Function (rcp_ecu_input): '<Root>/ECU_Input' */
Input1 = fPumpOut5Vol ;
/* S-Function (rcp_ecu_input): '<Root>/ECU_Input1' */
Input3 = fValvePwmOut1Vol ;
/* Sum: '<Root>/Add2' incorporates:
* DotProduct: '<Root>/Dot Product'
* Sum: '<Root>/Add'
* Sum: '<Root>/Add1'
*/
Output = ((Input1 + Input2) + Input3) + Input3 * Input2;
The "Output" is assigned before its caculationg, which make the "Output" update delayed one step.
How could I change the sequence of code generation to make the code as below:
Output = ((Input1 + Input2) + Input3) + Input3 * Input2;
enuRelay6Ctrl = Output ;
Thank you very much.

Respuestas (1)

Dinesh Yadav
Dinesh Yadav el 30 de Oct. de 2019

Categorías

Más información sobre Code Generation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by