ebook img

Simulating Nonlinear Circuits with Python Power Electronics: An Open-Source Simulator, Based on Python™ PDF

219 Pages·2018·5.6 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Simulating Nonlinear Circuits with Python Power Electronics: An Open-Source Simulator, Based on Python™

Shivkumar V. Iyer Simulating Nonlinear Circuits with Python Power Electronics An Open-Source Simulator, Based on Python™ Simulating Nonlinear Circuits with Python Power Electronics Shivkumar V. Iyer Simulating Nonlinear Circuits with Python Power Electronics An Open-Source Simulator, Based ™ on Python 123 ShivkumarV.Iyer Ontario Canada ThisbookisbasedonthefreeandopensourcesoftwarePythonPowerElectronicshostedat the websitehttp://www.pythonpowerelectronics.com ThesoftwarehasbeenreleasedundertheBSD3.0licensewhichbefoundintheLicensefile with the software orat http://opensource.org/licenses/BSD-3-Clause ISBN978-3-319-73983-0 ISBN978-3-319-73984-7 (eBook) https://doi.org/10.1007/978-3-319-73984-7 LibraryofCongressControlNumber:2017963531 ©SpringerInternationalPublishingAG,partofSpringerNature2018 Thisworkissubjecttocopyright.AllrightsarereservedbythePublisher,whetherthewholeorpart of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission orinformationstorageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilar methodologynowknownorhereafterdeveloped. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publicationdoesnotimply,evenintheabsenceofaspecificstatement,thatsuchnamesareexemptfrom therelevantprotectivelawsandregulationsandthereforefreeforgeneraluse. The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authorsortheeditorsgiveawarranty,expressorimplied,withrespecttothematerialcontainedhereinor for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictionalclaimsinpublishedmapsandinstitutionalaffiliations. Printedonacid-freepaper ThisSpringerimprintispublishedbytheregisteredcompanySpringerInternationalPublishingAGpart ofSpringerNature Theregisteredcompanyaddressis:Gewerbestrasse11,6330Cham,Switzerland To Rakhat Acknowledgements IwouldliketothankProf.BinWuandProf.BalaVenkateshoftheDepartmentof Electrical and Computer Engineering, Ryerson University, for their interest and supportinthedevelopmentofPythonPowerElectronics.Iwouldalsoliketothank Dr. Dan McGillivray who was the Executive Director of the Centre for Urban Energy, Ryerson University, for the many conversations we had related to the potential of the software. I would like to thank Mukundan R. of the National InstituteofIndustrialEngineering forhisconstantadvice andsuggestions.Iwould like to thank Zoubin Zarin for his advice in developing the software and with publishingthisbook.IwouldliketothankJanamejayaCforbeingaloyalfollower of the project and his constant encouragement. I would like to thank the Python communityanditsmanyactivemembersforalltheirsupportandforhavingmeas a speaker in PyCon Canada 2016 and PyCon Canada 2013. Shivkumar V. Iyer vii Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Concept Behind Simulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 The Reason for Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 Simulation in Power Electronics and the Challenges. . . . . . . . . . 5 1.4 Python Power Electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.5 Outline of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.6 About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2 Introduction to Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2 Overview of Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.3 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.4 Integers, Floats, and Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.5 Lists and Tuples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.6 Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.7 Examples of Python Code in the Simulator—Lists and Matrices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.8 Examples of Python Code in the Simulator—Strings . . . . . . . . . 26 2.9 Examples of Python Code in the Simulator—Dictionaries. . . . . . 30 2.10 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 3 User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.2 Circuit Representation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.3 Processing of Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.4 Data Structures of Components . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.4.1 Resistor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.4.2 Inductor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.4.3 VoltageSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.4.4 Capacitor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 ix x Contents 3.4.5 Ammeter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 3.4.6 Voltmeter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.4.7 VariableResistor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.4.8 VariableInductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 3.4.9 ControlledVoltageSource . . . . . . . . . . . . . . . . . . . . . . . 50 3.4.10 Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.4.11 Switch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 3.5 Logical Flow of the Simulation . . . . . . . . . . . . . . . . . . . . . . . . . 52 3.5.1 Launch Simulator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 3.5.2 Simulation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.5.3 Create Component Objects . . . . . . . . . . . . . . . . . . . . . . 54 3.5.4 Circuit Parameters File . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.5.5 Update Component Parameters . . . . . . . . . . . . . . . . . . . 55 3.6 Iterative Procedure During the Simulation . . . . . . . . . . . . . . . . . 56 3.6.1 Simulation Time Instant . . . . . . . . . . . . . . . . . . . . . . . . 57 3.6.2 Update Branch Data. . . . . . . . . . . . . . . . . . . . . . . . . . . 57 3.6.3 Generate Input Voltage. . . . . . . . . . . . . . . . . . . . . . . . . 57 3.6.4 Run Control Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 3.6.5 Perform Circuit Analysis . . . . . . . . . . . . . . . . . . . . . . . 58 3.6.6 Update Component Objects . . . . . . . . . . . . . . . . . . . . . 59 3.6.7 Write Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 3.7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4 Interface for User Control Functions . . . . . . . . . . . . . . . . . . . . . . . . 63 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.2 Inclusion of Control in the Simulator. . . . . . . . . . . . . . . . . . . . . 64 4.3 Special Variables in Control Code. . . . . . . . . . . . . . . . . . . . . . . 69 4.4 Time Scheduling Control Code . . . . . . . . . . . . . . . . . . . . . . . . . 74 4.5 Interfacing Control Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 5 Case Study—Shunt VAR Compensator . . . . . . . . . . . . . . . . . . . . . . 85 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 5.2 Description of the Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 5.3 Parameters of the Simulation and the Circuit . . . . . . . . . . . . . . . 89 5.4 First Stage in Control Development—Grid Synchronization . . . . 94 5.5 Second Stage in Control Development—Current Reference Generation and Closed-Loop Current Control. . . . . . . . . . . . . . . 102 5.6 Final Stage of Control Development—The Entire Circuit with the VSC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 5.7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 6 Nodes, Branches, and Loops. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 6.2 Jump Labels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Contents xi 6.3 Nodes and Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 6.4 Short Branches and Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 6.5 Connectivity Map for Nodal Analysis . . . . . . . . . . . . . . . . . . . . 141 6.6 Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 6.7 Loop Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 6.8 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 7 Circuit Analysis—Loop Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 7.2 Matrices for Loop Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 7.3 Solving the Matrix Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 7.4 Mapping Branch Currents and Loop Currents. . . . . . . . . . . . . . . 167 7.5 Effects of Time Constants on Loop Analysis . . . . . . . . . . . . . . . 170 7.6 Effect of Stiff Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 7.7 Loop Manipulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 7.8 Limitation of Loop Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 7.9 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 8 Circuit Analysis—Nodal Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 8.2 Concept of Nodal Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 8.3 Limitation of Loop Analysis in Nonlinear Circuits . . . . . . . . . . . 190 8.4 Applying Nodal Analysis in Nonlinear Circuits . . . . . . . . . . . . . 193 8.5 Continuing with Loop Analysis. . . . . . . . . . . . . . . . . . . . . . . . . 196 8.6 Event-Driven Circuit Updates . . . . . . . . . . . . . . . . . . . . . . . . . . 200 8.7 Process Flow in the Simulator. . . . . . . . . . . . . . . . . . . . . . . . . . 202 8.8 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 9 Conclusions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 9.1 Advantages of the Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 9.2 Drawbacks of the Simulator and Scope for Future Work. . . . . . . 209 9.3 Future of the Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Bibliography .. .... .... .... ..... .... .... .... .... .... ..... .... 215 Chapter 1 Introduction Abstract Thischapterintroducestheconceptofsimulationbydescribingitsuse- fulness with a few general engineering examples. The chapter then describes the current stateof the power systemand the recent changes thathave occurred along withthechangesthatareexpectedinthefuture.Thechapterdescribesthechallenge oftacklingclimatechangewithrenewableenergyandtherecentadvancesinwind andsolarenergy.Withthisbackground,thechapterintroducesPythonPowerElec- tronicsanddescribestheusefulnessofafreeandopen-sourcecircuitsimulatorand buildingacommunityofpowerengineers. · · · Keywords Simulation Modernpowersystems Renewableenergy Climate · · · change Smartgrids Powerquality Open-sourcetechnology 1.1 ConceptBehindSimulation Simulationfromitsbasicdefinitionistheimitationofanactualprocess.Inmodern times,thesoftwaredefinitionofsimulationisalsoavailable—therepresentationof the behavior or characteristics of one system through the use of another system, especially a computer program designed for the purpose. Though most engineers spendasignificantamountoftimesimulatingthesystemstheystudy,simulationas theabove-definedconceptissomethingalmosteveryonehasbeenexposedtoatsome pointoftime.Simulationbyitsdefinitioniswhenareal-worldprocessisrepeated. Letuslookatsomeexamplesofsimulationthatweneverstoppedtothinkabout. For most of us who were born when computers were ubiquitous household machines,thefirstformofsimulationsiscomputergames.Acomputergamemay be a car racing game, a war or fighting game, playing chess against the computer, oroneofthestrategygamesthathavebecomeverypopularrecently.Almostallof theseareimitationsofreal-worldevents.Behindthefancygraphicsandthecelebrity statuscharactersliesaverycomplexalgorithmthatcreatestheenvironmentwhere ©SpringerInternationalPublishingAG2018 1 S.V.Iyer,SimulatingNonlinearCircuitswithPythonPowerElectronics, https://doi.org/10.1007/978-3-319-73984-7_1

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.