Combining two C++ generated codes from 2 Simulink model

2 visualizaciones (últimos 30 días)
Trinh Nguyen Cong
Trinh Nguyen Cong el 20 de Mzo. de 2017
Editada: Trinh Nguyen Cong el 20 de Mzo. de 2017
I have 2 Simulink models, one is a spring-mass-damper system:
and one is a PI controller
with parameters: m = 1;c = 10;k = 50;Kp = 30;Ki = 70; reference = 0.2; After generating C++ codes using Simulink Coder for these 2 models, I tried to include both C++ files in one main class which simply run C++ code of the controller first and then the plant model. The results are quite different with the Simulink even though it converses to 0.2 eventually. I tried to connect them both in Simulink and then generate 1 C++ file, then run this file but the result is also different from Simulink file and from the combination of 2 generated codes. Could anyone give me a suggestion on how this happens? Thank you very much in advance!

Respuestas (0)

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by