Having problems simpower simulation with s-function

2 次查看(过去 30 天)
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
Arnaud Miege 2011-7-29
What's in the S-function? It is really necessary to use an S-function for your application?
Have a look at this question for uploading files:
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Alan Zhang
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
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 中查找有关 Programmatic Model Editing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by