# Having problems simpower simulation with s-function

조회 수: 1 (최근 30일)
Alan Zhang 2011년 7월 29일
Dear all,
I am struggling with a simpower simulation with s-function. The simulation is simulating a simple AC circuit with normal RLC load and a variable resistor, in which the variable resistor is simulated with S-function and controlled current source. This variable resistance is determined by the voltage between this variable resistor and calculated by an iterative calculation in S-function. Please find the files followed by the link: http://www.sendspace.com/file/9228s6
The problem is : this simulation with simpower toolbox and s-function couldn’t converge, while the same simulation applied with variable resistor with plecs toolbox works properly.
It seems to me that the problem with simpower and s-function may be caused by the delay generated by 1/z or memory block before the s-function . However, this memory or 1/z(delay) block had to be applied to make the simulink solver to solve algebraic loop caused by s-function and controlled current block. I couldn’t find a solution to make this simpower simulation converge just like it is in the plecs simulation.
Also I am wondering whether a variable resistor block in the simpower toolbox similar to the variable resistor in plecs toolbox is available in the later version of matlab (I couldn’t find it from matlab 2008b, and 2009a), that may solve my problem.
I will be really appreciated for your kind help! Best Regards,
Alan
##### 댓글 수: 2없음 표시없음 숨기기
Arnaud Miege 2011년 7월 29일
What's in the S-function? It is really necessary to use an S-function for your application?
Alan Zhang 2011년 7월 31일
There is an iterative calculation to calculate the variable resistor in the s function. Please find the files in http://www.sendspace.com/file/9228s6

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

### 답변 (1개)

Arnaud Miege 2011년 8월 1일
I don't have PLECS so I couldn't test the PLECS model. For the SimPowerSystems one, it's not clear to me what's causing the model to diverge. Have you tried using a MATLAB Function block (called Embedded MATLAB Function prior to R2011a) instead of an S-Function? It might make the debugging process easier. I suspect the problem is with the S-function.
With regards to the variable resistor in SimPowerSystems, have a look at the following:
HTH,
Arnaud

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

### 카테고리

Help CenterFile Exchange에서 Configure C/C++ S-Function Features에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by