average current mode control of switching power supplies

Thread Starter

anhnha

Joined Apr 19, 2012
905
Hi MrAl,
My chrome and downloaded text file show exactly the same. :)
For the code, I see it is very similar to C programming but there are some strange commands to me such as EuphoriaStart, atom type.
However, it is simply enough so I can create my own version using C programming.
So what should we do next? Calculate vC and iL for a pulse trains and change step size h also to see how it affect?
 

MrAl

Joined Jun 17, 2014
11,496
Hi MrAl,
My chrome and downloaded text file show exactly the same. :)
For the code, I see it is very similar to C programming but there are some strange commands to me such as EuphoriaStart, atom type.
However, it is simply enough so I can create my own version using C programming.
So what should we do next? Calculate vC and iL for a pulse trains and change step size h also to see how it affect?
Hello again,

Yes calculating vC and iL is really the whole goal for this try.
You can vary h too in order to see the effect it has on the outcome.
"EuphoriaStart()" is just a command to tell the interpreter that there is program code to follow, so handle that as a program rather than just text. That way i can mix program code with plain text without using rem's and such, and create a document that looks like a document rather than one big program :)

This method of analysis is very handy. The next step would be to see if you can add stuff to teh circuit and get the results from that. I guess you realize you have to change the code to make E1 equal to 1 sometimes and E1 equal to 0 other times, and if you want 12v input then make E1 12 sometimes and E1 zero when the pulse is off, through program code such as if/then/else statements.
So your goal would be twofold then:
1. Write new derivatives and solution sets.
2. Run the program and see how well it works.

I should mention that the derivatives and solution sets should be written in a more clear form. I usually use functions but even plain code will do it.
So for a derivative such as (fictitious here):
dv/dt=E/RC-v/RC
di/dt=i-v/R

and solution:
v=v+h*dv/dt
i=i+h*di/dt

we would instead just do:
DV=E/RC-v/RC
DI=i-v/R

and then we can do:
v=v+h*DV
i=i+h*DI

with the exception that we have to keep calculating DV and DI over and over again, which means a function could be used instead.
The organization of the program seems neater that way but it's up to you.

Yes the language used is just like a subset version of C so it is easy to follow.
A console app does the trick too, unless you want to get fancy and add a nice window and maybe even a graph.

If you get ambitious you can try to develop a second order method. We are using a first order method for now, but a second order method is more accurate. It does complicate the code though.
 
Top