{"id":5411,"date":"2014-06-27T16:36:00","date_gmt":"2014-06-27T20:36:00","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=5411"},"modified":"2018-09-14T06:39:13","modified_gmt":"2018-09-14T10:39:13","slug":"configurable-simulink-model-for-dc-dc-converters-with-pwm-pi-control","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2014\/06\/27\/configurable-simulink-model-for-dc-dc-converters-with-pwm-pi-control\/","title":{"rendered":"Configurable Simulink Model for DC-DC Converters with PWM PI Control"},"content":{"rendered":"<div class=\"content\">\r\n\r\n<a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/29096\">Idin<\/a>'s pick for this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/18833-configurable-simulink-model-for-dc-dc-converters-with-pwm-pi-control\">Configurable Simulink Model for DC-DC Converters with PWM PI Control<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/22524\">Yi Cao<\/a>.\r\n\r\n&nbsp;\r\n\r\nDr. Yi Cao has contributed a wealth of useful tools to the File Exchange (I saw 66 at the time of this writing). This week\u2019s\r\nPick came in handy for me recently as I was trying to investigate and demonstrate the value of Simulink for modeling <a href=\"http:\/\/en.wikipedia.org\/wiki\/DC-to-DC_converter\">DC-DC converters<\/a> .\r\n\r\nPower management ICs (<a href=\"http:\/\/en.wikipedia.org\/wiki\/Power_management_integrated_circuit\">PMICs<\/a>) are critical pieces of most electronic systems, especially battery-operated devices such as mobile phones and tablets. As\r\nit was put to me recently, \u201cPMICs are equivalent to the devices that turn the lights on at power-up, and turn them off when\r\npowering down.\u201d The PMIC provides required amounts of power to different parts of the system. An important part of a PMIC\r\nis typically one or more DC-DC converter to provide regulated voltages to different parts of a system.\r\n\r\nIn this submission Yi Cao provides a nice example of how the behavior of DC-DC converters can be modeled and simulated in\r\nSimulink. These converters fall under three general classes: buck, boost, and buck-boost (buck steps down the input voltage,\r\nboost steps it up, and buck-boost inverts the polarity). Yi\u2019s example covers all three classes (using their classic topologies).\r\nThe core of this submission is a Simulink model that shows how the whole system works.\r\n\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/main627\/buck_pwm.png\" alt=\"\" hspace=\"5\" vspace=\"5\" \/>\r\n\r\nThis model is simulating a full closed-loop system. The converter needs to hold its output voltage constant as the amount\r\nof current being drawn varies. The control loop (and the PWM PI controller) work to correct fluctuations in output voltage\r\n(usually due to fluctuations in output current). He's done some good work to create one customizable block that can be configured\r\nto simulate any desired topology (buck, boost, or buck-boost).\r\n\r\nA really nice feature of this submission is the included tutorial (PDF) on deriving the mathematical equations used in the\r\nmodel from circuit diagrams. I highly recommend reading through this document. And if there was any doubt that the derivations\r\nwere correct, my colleague <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/4156\">Dick Benson<\/a> created a circuit-level model of the same system to check the results.\r\n\r\nThe results from the circuit simulation were nearly identical to those from Yi\u2019s model. The figure below shows two plots:\r\nthe output voltage and inductor current. In each plot the result of the circuit simulation is overlaid on top of the output\r\nfrom Yi\u2019s model. The two traces can hardly be distinguished.\r\n\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/main627\/idin_figure2.png\" alt=\"\" hspace=\"5\" vspace=\"5\" \/>\r\n\r\nIf you would like to see some examples of these systems simulated using real circuit elements, download the Mixed-Signal Library\r\nfrom the bottom of <a href=\"https:\/\/www.mathworks.com\/solutions\/mixed-signal-systems.html\">this page<\/a>, and go to the \u201cSwitching Power\u201d examples. Note that the examples using circuit elements require <a href=\"https:\/\/www.mathworks.com\/products\/simscape-electrical.html\">Simscape Electrical<\/a> . As always, your thoughts and comments are greatly appreciated.\r\n\r\n<script>\/\/ <![CDATA[\r\nfunction grabCode_52acbff7ed9b44f785304b0f3547c808() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='52acbff7ed9b44f785304b0f3547c808 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 52acbff7ed9b44f785304b0f3547c808';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Idin Motedayen-Aval';\r\n        copyright = 'Copyright 2014 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('\r\n\r\n<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\r\n\r\n\r\n\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }\r\n\/\/ ]]><\/script>\r\n<p style=\"text-align: right; font-size: xx-small; font-weight: lighter; font-style: italic; color: gray;\">\r\n<a><span style=\"font-size: x-small; font-style: italic;\">Get\r\nthe MATLAB code\r\n<noscript>(requires JavaScript)<\/noscript><\/span><\/a>\r\n\r\nPublished with MATLAB\u00ae R2014a<\/p>\r\n\r\n<\/div>\r\n<!--\r\n52acbff7ed9b44f785304b0f3547c808 ##### SOURCE BEGIN #####\r\n%% Configurable Simulink Model for DC-DC Converters with PWM PI Control\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/29096 Idin>'s pick for this week is <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/18833-configurable-simulink-model-for-dc-dc-converters-with-pwm-pi-control Configurable Simulink Model for DC-DC % Converters with PWM PI Control>\r\n% by <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/22524 Yi % Cao>.\r\n\r\n%%\r\n% Dr. Yi Cao has contributed a wealth of useful tools to the File Exchange\r\n% (I saw 66 at the time of this writing).  This week\u00e2\u20ac&#x2122;s Pick came in handy\r\n% for me recently as I was trying to investigate and demonstrate the value\r\n% of Simulink for modeling <http:\/\/en.wikipedia.org\/wiki\/DC-to-DC_converter % DC-DC converters> .\r\n%\r\n% Power management ICs\r\n% (<http:\/\/en.wikipedia.org\/wiki\/Power_management_integrated_circuit % PMICs>) are critical pieces of most electronic systems, especially\r\n% battery-operated devices such as mobile phones and tablets. As it was put\r\n% to me recently, \u00e2\u20ac\u0153PMICs are equivalent to the devices that turn the lights\r\n% on at power-up, and turn them off when powering down.\u00e2\u20ac\ufffd  The PMIC provides\r\n% required amounts of power to different parts of the system.  An\r\n% important part of a PMIC is typically one or more DC-DC converter to\r\n% provide regulated voltages to different parts of a system.\r\n%\r\n% In this submission Yi Cao provides a nice example of how the behavior of\r\n% DC-DC converters can be modeled and simulated in Simulink.  These\r\n% converters fall under three general classes: buck, boost, and\r\n% buck-boost (buck steps down the input voltage, boost steps it up, and\r\n% buck-boost inverts the polarity). Yi\u00e2\u20ac&#x2122;s example covers all three classes\r\n% (using their classic topologies). The core of this submission is a\r\n% Simulink model that shows how the whole system works.\r\n%\r\n%%\r\n% <<buck_pwm.png>>\r\n\r\n%%\r\n% This model is simulating a full closed-loop system.  The converter needs\r\n% to hold its output voltage constant as the amount of current being drawn\r\n% varies.  The control loop (and the PWM PI controller) work to correct\r\n% fluctuations in output voltage (usually due to fluctuations in output\r\n% current). He's done some good work to create one customizable block that\r\n% can be configured to simulate any desired topology (buck, boost, or\r\n% buck-boost).\r\n%\r\n%\r\n% A really nice feature of this submission is the included tutorial (PDF)\r\n% on deriving the mathematical equations used in the model from circuit\r\n% diagrams.  I highly recommend reading through this document.  And if\r\n% there was any doubt that the derivations were correct, my colleague\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/4156 Dick % Benson> created a circuit-level model of the same system to check the\r\n% results.\r\n%\r\n% The results from the circuit simulation were nearly identical to those\r\n% from Yi\u00e2\u20ac&#x2122;s model.  The figure below shows two plots: the output voltage\r\n% and inductor current.  In each plot the result of the circuit simulation\r\n% is overlaid on top of the output from Yi\u00e2\u20ac&#x2122;s model.  The two traces can\r\n% hardly be distinguished.\r\n%\r\n% <<idin_figure2.png>>\r\n%\r\n% If you would like to see some examples of these systems simulated using\r\n% real circuit elements, download the Mixed-Signal Library from the bottom\r\n% of <https:\/\/www.mathworks.com\/solutions\/mixed-signal-systems.html this page>, and go to\r\n% the \u00e2\u20ac\u0153Switching Power\u00e2\u20ac\ufffd examples.  Note that the examples using circuit\r\n% elements require <https:\/\/www.mathworks.com\/products\/simpower\/ % SimPowerSystems> . As always, your thoughts and comments\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=5400#respond here> are greatly appreciated.\r\n\r\n##### SOURCE END ##### 52acbff7ed9b44f785304b0f3547c808\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/main627\/buck_pwm.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\n\r\nIdin's pick for this week is Configurable Simulink Model for DC-DC Converters with PWM PI Control by Yi Cao.\r\n\r\n&nbsp;\r\n\r\nDr. Yi Cao has contributed a wealth of useful tools to the File Exchange... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2014\/06\/27\/configurable-simulink-model-for-dc-dc-converters-with-pwm-pi-control\/\">read more >><\/a><\/p>","protected":false},"author":36,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5411"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=5411"}],"version-history":[{"count":8,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5411\/revisions"}],"predecessor-version":[{"id":10117,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5411\/revisions\/10117"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=5411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=5411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=5411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}