Sunday, February 5, 2017

Releasing the book

I am happy to announce the release of my book "Simulating non-linear circuits with Python Power Electronics: an open source simulator based on Python". The book has been self-published and released on Gumroad. The link is:
To read a sample chapter, I have released Chapter 4 of the book on my website:
Follow my Facebook page for continuous updates:

The outline of the book is below:

Chapter 1 introduces the concept of simulation and describes the challenges in circuit simulation. Python Power Electronics as an open source circuit simulator is proposed with its objectives and target audience.

Chapter 2 provides an overview of the Python programming language. For a detailed tutorial, a reader is recommended to either read a book on Python programming or follow an online tutorial on the internet. The purpose of the chapter is to enable the reader to understand the code segments that will be provided in the subsequent chapters that deal with user-defined control functions and the case study.

Chapter 3 describes the interface that the simulator uses to interact with the user. The chapter describes the philosophy behind choosing spreadsheets as the mode of extracting information from the user. Spreadsheets are used by the user to enter simulation parameters,circuit schematics, parameters of the components in the circuit schematics and also the structure of control functions. The chapter describes how the structure of every component class in the simulator library and how the data entered by the user is processed by each component class. The chapter also describes the concept of how classes are instantiated for every component found resulting in objects and how these objects are referenced by the simulator. The chapter describes the execution flow in the simulator and how the simulator processes the data provided by the user and makes it available to the core simulation engine. The chapter does not describe how user-defined control functions are processed as the whole of Chapter 4 is dedicated for this purpose.

Chapter 4 describes how a user can write control functions for a simulation. Chapter 3 has described which of the circuit components can be controlled externally. Besides these controllable components, a control function need not perform a control action, but can instead be used to process simulation data or perform calculations. The chapter describes how the control functions have to be written as Python 2 files and specified in the simulation parameter spreadsheet. Every control function will have an interface to the simulation in terms of inputs and outputs and this interface is described by a spreadsheet called a descriptor. Besides inputs and outputs, every control function can use certain types of variables that perform special functions. The chapter describes the importance of each type of control variable and how they are implemented in the simulator. The chapter describes how control functions are scheduled by the simulator using time events and with an example, it is described how the simulator ensures that the control functions execute at the desired time instant. A simple example has been provided to describe how control functions can be interfaced with the simulation and also with each other.

Chapter 5 describes how a user can simulate a circuit with a power electronic converter. The example chosen has been a shunt connected three-phase VAR compensator realized using a two-level voltage source converter in a three-phase system. The voltage source converter consists of controllable ideal switches that are turned on and turned off by pulse width modulation. The chapter describes how the user can build this simulation in stages such that every new subsystem added to the circuit can be verified. The chapter also describes how the user can write control functions with detailed examples of each control function in the simulation and also design the control interfaces through descriptors. Every stage of the chapter contains simulation results to show how the project develops. Through this example, every feature of the simulator has been described with details so that users can develop their own simulations.

Chapter 6 describes how the simulator processes the circuit schematics that the user enters in spreadsheets. The connectivity information is extracted from the circuit schematics in the form of nodes, branches and loops. Nodes, branches and loops are used to perform circuit analysis through loop analysis and nodal analysis which are described in the next chapters. The chapter describes through sample circuits, the algorithms used to determine the nodes, branches and loops. The chapter introduces the concept of the LoopMap which is used for performing loop analysis in Chapter 7 and the concept of KCLBranchMap which is used for performing nodal analysis in Chapter 8.

Chapter 7 describes how loop analysis is performed in the simulator. The chapter describes how the matrix equation for performing loop analysis is generated from the LoopMap described in Chapter 6. A brief description is provided about how the matrices in this equation are transformed using row operations such that they can be solved by using numerical integration techniques. The chapter describes how loop currents and branch currents in the circuit can be mapped which allows for calculation of branch currents from loop currents and vice versa. The chapter describes with an example how time constants of branches of the circuit can make the simulation unstable and introduces the concept of a stiff loop. By providing a sample circuit and its corresponding LoopMap, the chapter describes the need to isolate stiff loops so as to be able to simulate a circuit. With this example, the concept of loop manipulations is described and with advanced examples, the effectiveness of the procedure is described. The chapter describes the limitation of loop analysis with another set of examples and therefore the need for nodal analysis.

Chapter 8 describes how nodal analysis can be used to determine the currents through stiff branches (that have a very low time constant) in the circuit. With the example of a simple buck converter, the chapter describes how loop analysis is insufficient in determining the conduction of power devices during switching events. The chapter then describes how nodal analysis can be used effectively in determining how power devices conduct and the transfer of current from one device to another. The chapter introduces the concept of events and how the matrix equations for the circuit will be constant until an event occurs. The chapter finally describes the logical flow of processes in the simulator as it performs loop analysis and nodal analysis one after the other.

Chapter 9 will conclude the book by highlighting the advantages of the simulator and the future development intended in this project.