Greeting to all Plecs users,
I'm an electrical engineering student and I'm new to PLECS simulations.
I have some trouble with implementing some discrete equations in a C-script. I have a set of continuous equations:
and instead of modeling them with existing block (transfer functions, gains, summation points etc.) I would like to implement them into a C-script as a set of discrete equations with a non fixed sampling time (I would use the non fixed step from PLECS simulation):
Unfortunaly, when starting the simulation I always get an error that says a derivative is infinite or NaN and is pointing to the C-script in PLECS' model of a synchronous machine that I'm using.
Could someone of You guys be so kind and check my C-script which is attached and see where is the problem, I suppose I wrote something wrong in C or defined some DiscState variables wrong.
Thank You very much for Your answers and precious time,