S-function works in normal mode but doesn't in external mode

조회 수: 1 (최근 30일)
Arthur Nascimento
Arthur Nascimento 2019년 2월 25일
댓글: Arthur Nascimento 2019년 3월 11일
I'm trying to implement a simple s function builder ode solver for a rlc circuit, it is suposed to return the value of the capacitor voltage.
While it works fine in normal mode.
2019-02-25.png
when deployed to TI TMS320F28379D the response remais at 0, it simply doesn't work. It builds and deploys fine.
2019-02-25 (1).png
Any help is aprecciated.

답변 (3개)

Venkatesh Chilapur
Venkatesh Chilapur 2019년 2월 26일
Hi,
When deploying the model on target we configure it for Fixed step disctere solver as the controller runs in discrete amount of time. It also depends on the step time your model is configured to run. If the model is configured to run fast, then the external mode may not work.
HTH,
Venkatesh C
  댓글 수: 1
Arthur Nascimento
Arthur Nascimento 2019년 2월 26일
Hello, thanks for the answer, this is how the solver is set up:
2019-02-26.png
I also tried some higher values fo the fixed step time, same problem.

댓글을 달려면 로그인하십시오.


Venkatesh Chilapur
Venkatesh Chilapur 2019년 2월 27일
Can you do a crtl+j and send the snap of Sample Time Legend that pop's up as below.
Capture.JPG
  댓글 수: 1
Arthur Nascimento
Arthur Nascimento 2019년 2월 27일
편집: Arthur Nascimento 2019년 2월 27일
The model along with the s function files are attached, something tells me that the external mode isn't calling the "update" part of the code.

댓글을 달려면 로그인하십시오.


Venkatesh Chilapur
Venkatesh Chilapur 2019년 3월 4일
Hi,
Could run the model in external mode and could recieve only zero.
I have not debugged the S-Function, but I can recommend to start with simple model and see if that works.
I could see a sample time of 0.2sec in your attached model. You may try to run at this rate.
Regards,
Venkatesh C
  댓글 수: 1
Arthur Nascimento
Arthur Nascimento 2019년 3월 11일
Hello, I have found the problem to be the use of the simStruct functions. I was using it to get the sample time value. While it works fine in normal mode, it doesn't seem to work in external mode. I need to set the sample time in simulink configs and set the same sample time in the code for the solver to run properly. Thanks for the help anyway!!

댓글을 달려면 로그인하십시오.

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by