Combining two C++ generated codes from 2 Simulink model

조회 수: 2 (최근 30일)
Trinh Nguyen Cong
Trinh Nguyen Cong 2017년 3월 20일
편집: Trinh Nguyen Cong 2017년 3월 20일
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!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by