How to determine the sequence of generated code?

1 回表示 (過去 30 日間)
Bo Zhou
Bo Zhou 2019 年 10 月 27 日
回答済み: Dinesh Yadav 2019 年 10 月 30 日
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.

回答 (1 件)

Dinesh Yadav
Dinesh Yadav 2019 年 10 月 30 日

カテゴリ

Help Center および File ExchangeCode Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by