S
Scott Ronald
- Jan 1, 1970
- 0
Hi
I am trying to simulate a boost converter like this:
[Vin]-------[inductor]---|----------[diode]----|-------[output]
| | |
| [control]--[mosfet] [capacitor]
| | |
|----------------------|---------------------|
So I was thinking of splitting into 2 sections: one for the on state and
one for the off-state.
On State:
[Vin]-------[inductor]-----|---------------------|------------|
| | | |
| / [capacitor] [Load]
| / | |
|------------------------|---------------------|------------|
I can use this algorithm for the on state ( I got it here from John Larkin)
FOR T = 0 TO 1 STEP DT
IL = IL + (Vin-Vout) * DT / L
IR = Vout / R
IC = IL - IR
Vout = Vout + IC * DT / C
NEXT
So now I just need to do the off state.
Off state:
[Vin]-------[inductor+inductorResistance]-----|
| |
| |
|-------------------------------------------|
where the inductor charges for the time the switch is closed. What I
need to figure out is the voltage at top of the load/cap is the moment
the switch is opened. The only way i know how to do this is use the
exponential charging function.Vf=Vi(1-e^[-t/T]) Can anyone here write
the fancy algorithm like above that makes it more efficient for code?
I would love to see a text or something on how to write my own code like
this, anyone know of one?
Scott
I am trying to simulate a boost converter like this:
[Vin]-------[inductor]---|----------[diode]----|-------[output]
| | |
| [control]--[mosfet] [capacitor]
| | |
|----------------------|---------------------|
So I was thinking of splitting into 2 sections: one for the on state and
one for the off-state.
On State:
[Vin]-------[inductor]-----|---------------------|------------|
| | | |
| / [capacitor] [Load]
| / | |
|------------------------|---------------------|------------|
I can use this algorithm for the on state ( I got it here from John Larkin)
FOR T = 0 TO 1 STEP DT
IL = IL + (Vin-Vout) * DT / L
IR = Vout / R
IC = IL - IR
Vout = Vout + IC * DT / C
NEXT
So now I just need to do the off state.
Off state:
[Vin]-------[inductor+inductorResistance]-----|
| |
| |
|-------------------------------------------|
where the inductor charges for the time the switch is closed. What I
need to figure out is the voltage at top of the load/cap is the moment
the switch is opened. The only way i know how to do this is use the
exponential charging function.Vf=Vi(1-e^[-t/T]) Can anyone here write
the fancy algorithm like above that makes it more efficient for code?
I would love to see a text or something on how to write my own code like
this, anyone know of one?
Scott