How to design a charging and discharging circuit for my supercapacitor using only Simulink blocks without the simpowersystems
55 次查看(过去 30 天)
显示 更早的评论
Dear Matlab community, As part of a project I am working on, I have to two sources of voltage (basically a hybrid system) that is supposed to charge a supercapacitor. The algorithm should be such that, the supercapcitor charges for sometime and then then it discharges to the load after sometime. I am supposed to use matlab simulink blocks without the simpower systems as required! and I incoporate matlab functions when necesassry. I have tried to read up and come up with this part of the model but to no avail, Can someone kindly help me with a code that executes the same of if possible can the show me how i can do using simulink block?
thank you for taking your time
0 个评论
采纳的回答
Jon
2020-12-3
编辑:Jon
2020-12-3
In general to model charging a capacitor in Simulink I would think about it this way.
Go back to fundamentals
The voltage on a capacitor is a function of the total charge it has accumulated. This is the integrated current flowing into the capacitor. So the heart of your capacitor is just an integrator block. So put an integrator block into your model. The input of the integrator block, will be the current feeding the capacitor. I'll get to how you calculate that later. The output of the integrator will be the charge. For a linear capacitor, the voltage will just be the charge divided by the capacitance, C. So connect a gain block to the output of your integrator, and give it a value 1/C. The output of that gain block will now be your voltage. (You could put in some non-linear function, to give v as function of charge if it is not a simple linear capacitor)
Now you have to ask yourself, what determines this current that feeds your integrator. Let's say the current comes out of some kind of voltage source. So put a constant block in your model to represent the voltage source. Let's also assume that the source has some internal losses, represented by a series resitance, Rint. Now lets imagine what happens when we put the capacitor across the battery terminals. The current into the capacitor will be given (by Ohms law) as the ideal source voltage minus the capacitor voltage divided by the resistance. So now back to the Simulink model. To get the current flowing into the capacitor (integrator) you subtract the capacitor voltage (output of the gain block) from the voltage source (constant block) using a summer block (with inputs +-) take the output of that and connect it to a gain with a value of 1/R. The output of that will be the current into the capacitor so connect that to the input to your integrator.
Suppose instead that you want to discharge your capacitor into a load. In that case the current "into" the integrator will be negative. Assuming you discharge into a simple resistive load it will be given by -Vc/Rload (where Vc is the capacitor voltage). So you could do this on your Simulink diagram by connecting the output of your capacitor blocks (the 1/C gain block) which gives the capacitor voltage to a gain block with a value of (-1/Rload). This gives the current and you connect the output of that block to the input of your integrator.
Now if you want to swich from charging to discharging, you could use a Simulink Switch block to select either the output of the source load resistor gain (1/Rint) or the load resitor gain (1/Rload). Note you can keep both resistors connected to the output of the capacitor 1/C gain block.
You can then I think see how to further elaborate this with a second charging source.
2 个评论
Jon
2020-12-4
I hope this was helpful for you. I realize the explanation was rather lengthy and wordy. I could have just attached a small illustrative Simulation model instead. Hopefully my detailed explanation of the thought process in building the model will help you be able to move ahead with this and other projects.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!