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,