Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

How to generate duty cycle using C-Script?

+1 vote
226 views
I am trying to build MPPT block on C-script, there is no error in code. But still not getting out put duty cycle. Attached is the algorithm i implemented on C-script. Please guide me what changes i need to make?

Best Wishes
asked Apr 17 by Sikander (16 points)

2 Answers

+1 vote
 
Best answer
See the PLECS documentation for a demo model called "Grid-Connected Single-Phase Solar Inverter", which implements MPP tracking. Also, read the documentation on C-Scripts and try easier examples before attempting to implement an MPP tracker.

This should get you started.
answered Apr 19 by Falk Kyburz (159 points)
selected Apr 26 by Sikander
+2 votes
Your chances to get an answer will highly improve if you attach a model rather than screenshots of source code.
answered Apr 18 by Oliver Schwartz (147 points)
Okay! I will attach it
here is the attached file. Need serious help in solving this problem. Thanks
  1. At t=0, both inputs of the C-Script are 0. Dividing IK by VK results in NaN (Not a Number).
  2. Any mathematical operation involving NaN results in NaN
Thanks. It's obvious because of logarithm function. But what after t=0? Can you please tell me how to solve it?
After t=0 you are adding values to delta, which is NaN, and therefore stays NaN.
Thank you very much. I will try according to that
...