Having problems simpower simulation with s-function

6 visualizaciones (últimos 30 días)
Alan Zhang
Alan Zhang el 29 de Jul. de 2011
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 comentarios
Arnaud Miege
Arnaud Miege el 29 de Jul. de 2011
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 el 31 de Jul. de 2011
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

Iniciar sesión para comentar.

Respuestas (1)

Arnaud Miege
Arnaud Miege el 1 de Ag. de 2011
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

Community Treasure Hunt

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

Start Hunting!

Translated by