Azzera filtri
Azzera filtri

How to determine the sequence of generated code?

3 visualizzazioni (ultimi 30 giorni)
Bo Zhou
Bo Zhou il 27 Ott 2019
Risposto: Dinesh Yadav il 30 Ott 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.

Risposte (1)

Dinesh Yadav
Dinesh Yadav il 30 Ott 2019

Categorie

Scopri di più su Code Generation in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by