Effacer les filtres
Effacer les filtres

How to determine the sequence of generated code?

3 vues (au cours des 30 derniers jours)
Bo Zhou
Bo Zhou le 27 Oct 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.

Réponses (1)

Dinesh Yadav
Dinesh Yadav le 30 Oct 2019

Catégories

En savoir plus sur Code Generation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by