Electric Circuit Analysis with EasyEDA: A Student's Guide (Synthesis Lectures on Engineering, Science, and Technology) 9783031002915, 9783031002922, 3031002911

This book explains and focuses on analysis of electric circuits using an up-to-date software package. The book is filled

154 124 7MB

English Pages 121 [116] Year 2022

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Electric Circuit Analysis with EasyEDA: A Student's Guide (Synthesis Lectures on Engineering, Science, and Technology)
 9783031002915, 9783031002922, 3031002911

Table of contents :
Preface
Contents
1 Basic Concepts
1.1 Introduction
1.2 Example 1: Simple Resistive Voltage Divider
1.3 Example 2: Differential Voltage Measurement
1.4 Example 3: Current Measurement
1.5 Example 4: Exporting the Drawn Schematic as a Graphical File
1.6 Example 5: Multimeter Block
1.7 Example 6: Sinusoidal Voltage Source
1.8 Example 7: Measurement of Phase Difference
1.9 Example 8: Wattmeter Block
1.10 Example 9: Observing the Power Waveform
1.11 Example 10: Thevenin Equivalent Circuit
1.12 Example 11: RLC Circuit
1.13 Example 12: Step Response of Electric Circuits
1.14 Example 13: Impulse Response of Electric Circuits (I)
1.15 Example 14: Impulse Response of Electric Circuits (II)
2 Three-Phase Circuits and Magnetic Coupling
2.1 Introduction
2.2 Example 1: Delta-Connected Three-Phase Source
2.3 Example 2: Y (Star)-Connected Three-Phase Source
2.4 Example 3: Coupled Inductors
2.5 Example 4: Transformer
3 Frequency Response and DC Sweep Analysis
3.1 Introduction
3.2 Example 1: Frequency Response of Electric Circuits (I)
3.3 Example 2: Frequency Response of Electric Circuits (II)
3.4 Example 3: Input Impedance of Electric Circuits (I)
3.5 Example 4: Input Impedance of Electric Circuits (II)
3.6 Example 5: DC Sweep Analysis
Exercises
References

Citation preview

Synthesis Lectures on Engineering, Science, and Technology

Farzin Asadi

Electric Circuit Analysis with EasyEDA

Synthesis Lectures on Engineering, Science, and Technology

The focus of this series is general topics, and applications about, and for, engineers and scientists on a wide array of applications, methods and advances. Most titles cover subjects such as professional development, education, and study skills, as well as basic introductory undergraduate material and other topics appropriate for a broader and less technical audience.

Farzin Asadi

Electric Circuit Analysis with EasyEDA

Farzin Asadi Department of Electrical and Electronics Engineering Maltepe University Marmara Egitim Koyu, Istanbul, Turkey

ISSN 2690-0300 ISSN 2690-0327 (electronic) Synthesis Lectures on Engineering, Science, and Technology ISBN 978-3-031-00291-5 ISBN 978-3-031-00292-2 (eBook) https://doi.org/10.1007/978-3-031-00292-2 © The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland AG 2022 This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part 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 or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. 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 authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. This Springer imprint is published by the registered company Springer Nature Switzerland AG The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland

In loving memory of my father Moloud Asadi and my mother Khorshid Tahmasebi, always on my mind, forever in my heart.

Preface

A computer simulation is an attempt to model a real-life or hypothetical situation on a computer so that it can be studied to see how the system works. By changing variables in the simulation, predictions may be made about the behavior of the system. So, computer simulation is a tool to virtually investigate the behavior of the system under study. Computer simulation has many applications in science, engineering, education and even in entertainment. For instance, pilots use computer simulations to practice what they learned without any danger and loss of life. A circuit simulator is a computer program that permits us to see the circuit behavior, i.e., circuit voltages and currents, without making it. The use of a circuit simulator is a cheap, efficient and safe way to study the behavior of circuits. A circuit simulator even saves your time and energy. It permits you to test your ideas before you go wasting all that time building it with a breadboard or hardware, just to find out it doesn’t really work. EasyEDA is a powerful online PCB design tool. It can be used to simulate circuits as well. This book shows how to simulate an electric circuit in an EasyEDA environment. It is a valuable source for students who take Electric Circuits I or II courses. After finishing this book, the reader is able to use the tools provided by EasyEDA to analyze any kind of electric circuit. I hope that this book will be useful to the readers, and I welcome comments on the book. Istanbul, Turkey

Farzin Asadi [email protected]

vii

Contents

1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Example 1: Simple Resistive Voltage Divider . . . . . . . . . . . . . . . . . . . . . . . 1.3 Example 2: Differential Voltage Measurement . . . . . . . . . . . . . . . . . . . . . . 1.4 Example 3: Current Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Example 4: Exporting the Drawn Schematic as a Graphical File . . . . . . 1.6 Example 5: Multimeter Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.7 Example 6: Sinusoidal Voltage Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8 Example 7: Measurement of Phase Difference . . . . . . . . . . . . . . . . . . . . . . 1.9 Example 8: Wattmeter Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.10 Example 9: Observing the Power Waveform . . . . . . . . . . . . . . . . . . . . . . . . 1.11 Example 10: Thevenin Equivalent Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . 1.12 Example 11: RLC Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.13 Example 12: Step Response of Electric Circuits . . . . . . . . . . . . . . . . . . . . . 1.14 Example 13: Impulse Response of Electric Circuits (I) . . . . . . . . . . . . . . . 1.15 Example 14: Impulse Response of Electric Circuits (II) . . . . . . . . . . . . . .

1 1 1 18 22 23 24 26 31 35 38 44 48 57 59 63

2 Three-Phase Circuits and Magnetic Coupling . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Example 1: Delta-Connected Three-Phase Source . . . . . . . . . . . . . . . . . . . 2.3 Example 2: Y (Star)-Connected Three-Phase Source . . . . . . . . . . . . . . . . . 2.4 Example 3: Coupled Inductors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 Example 4: Transformer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

67 67 67 72 73 82

3 Frequency Response and DC Sweep Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Example 1: Frequency Response of Electric Circuits (I) . . . . . . . . . . . . . . 3.3 Example 2: Frequency Response of Electric Circuits (II) . . . . . . . . . . . . .

87 87 87 94

ix

x

Contents

3.4 3.5 3.6

Example 3: Input Impedance of Electric Circuits (I) . . . . . . . . . . . . . . . . . Example 4: Input Impedance of Electric Circuits (II) . . . . . . . . . . . . . . . . Example 5: DC Sweep Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

97 102 104

Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

107

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

111

1

Basic Concepts

1.1

Introduction

In this chapter, you will learn how to analyze electric circuits in EasyEDA software. The theory behind the studied circuits can be found in any standard circuit theory textbook [1–4]. It is a good idea to do some hand calculations for the circuits that are given and compare them with EasyEDA results.

1.2

Example 1: Simple Resistive Voltage Divider

In this example, we want to simulate the resistive voltage divider shown in Fig. 1.1. From 1k 1 × Vin = 1k+2.2k × 10 = 3.13 V and basic circuit theory, we know that VR1 = R1R+R L

VRL =

RL R1 +RL

Vin R1 +RL

× Vin =

2.2k 1k+2.2k

× 10 = 6.87 V. The current drawn from the DC source is

= = 3.125 mA. I= Let’s simulate this circuit. Go to https://easyeda.com/. Use the Register button (Fig. 1.2) to make an account if you don’t have any. Use the Login button (Fig. 1.2) to enter into your account. After entering into your account, click the EasyEDA Designer button (Fig. 1.3). This opens the window shown in Fig. 1.4. Click the Change to Simulation Mode button (Fig. 1.5). This activates the simulation mode for you (Fig. 1.6). The Standard Mode is used for PCB design. Click the File> New> Schematic (Fig. 1.7). This opens a new schematic for you (Fig. 1.8). 10 1k+2.2k

© The Author(s), under exclusive license to Springer Nature Switzerland AG 2022 F. Asadi, Electric Circuit Analysis with EasyEDA, Synthesis Lectures on Engineering, Science, and Technology, https://doi.org/10.1007/978-3-031-00292-2_1

1

2

Fig. 1.1 Simple resistive circuit

Fig. 1.2 EasyEDA website

Fig. 1.3 EasyEDA designer button

1 Basic Concepts

1.2

Example 1: Simple Resistive Voltage Divider

Fig. 1.4 EasyEDA start page

Fig. 1.5 Change to simulation mode button

3

4

1 Basic Concepts

Fig. 1.6 Simulation mode is activated

Fig. 1.7 Starting a new schematic

The opened schematic (Fig. 1.8) has grids by default. You can remove the grids if you like. In order to remove the grids, click on an empty point of the schematic. This causes the schematic properties to appear on the right side of the screen (Fig. 1.9). If you don’t see the schematic properties, click on the small rectangle shown in Fig. 1.10.

1.2

Example 1: Simple Resistive Voltage Divider

5

Fig. 1.8 New schematic page is opened

The grids will be removed if you select No for Visible Grid box (Fig. 1.9). The Grid Style box (Fig. 1.9) permits you to select the style of the grid (i.e., dot grid or line grid). In this book, we will use the parts in the EELib section (Fig. 1.11). Add two resistors to the schematic (Fig. 1.12). In order to do this, click on the resistor icon in the EELib. Then move the cursor to the canvas and left click to place it. You can use the R key on your keyboard to rotate a part. X and Y keys on the keyboard can be used for flip horizontal and flip vertical, respectively. You can remove a component by selecting it (left clicking on it) and pressing the Delete key on your keyboard. After adding a part to the schematic, another part is added to the mouse pointer automatically. You can press the Esc key on your keyboard or right click to remove the part added to the mouse pointer. You can see a list of available shortcut keys by clicking the Setting> Shortcut Keys Setting (Figs. 1.13 and 1.14). Add a voltage source to the canvas (Fig. 1.15). Add two ground to the canvas (Fig. 1.16). Connect the components together (Fig. 1.17). In order to do this, click on the component terminals. After clicking, a wire will be connected to the component terminal and the other end of the wire is connected to the mouse pointer. Now move the mouse pointer to the destination terminal and click on it. This connects the source and destination terminals.

6

1 Basic Concepts

Fig. 1.9 Canvas attributes

It’s time to set the value of components. Double click on the components’ values. This opens a box for you (Fig. 1.18). Enter the desired value into this box. Change the schematic of Fig. 1.17 to what is shown in Fig. 1.19. You can use the prefixes shown in Table 1.1 when you enter the values of components. The Voltage Probe block (Fig. 1.20) can be used to measure the voltage of nodes with respect to the ground. Add a Voltage Probe block to the schematic (Fig. 1.21). Double click on “volProbe1” and change it into “out” (Fig. 1.22). Use the File> Save (Fig. 1.23) to save your work. You need to save your work; otherwise, you can’t simulate it. After clicking the File> Save, the window shown in Fig. 1.24 appears on the screen. Enter the desired name into the Title box and click the Save button. Note that the file is not saved on your computer. It is saved on the website server computer.

1.2

Example 1: Simple Resistive Voltage Divider

7

Fig. 1.10 Click the shown button to see the Canvas attributes

After saving the file, click the Simulation> Simulation Settings (Fig. 1.25). This opens the Run your simulation window. Do the settings similar to Fig. 1.26 and click the Run button. The settings shown in Fig. 1.27 ask the EasyEDA to simulate the behavior of the circuit for [0, 10 ms] interval with 1 µs. EasyEDA calculates the value of output at t = 0, 1 µs, 2 µs, 3 µs, …, 10 ms. Note that the value of the maximum timestep must be less ; otherwise, you receive the error message shown in Fig. 1.27. Note than Stoptime−Starttime 10000 that the Maximum Timestep box determines the smoothness of the drawn graph. When

8

1 Basic Concepts

Fig. 1.11 EELib section

you are not happy with the smoothness of the obtained graph, decrease the value of the Maximum Timestep box. The simulation result is shown in Fig. 1.28. You can zoom in by left clicking on the graph, holding down the mouse’s left button and drawing a rectangle around the desired region. You can obtain the original view by double clicking on the graph. The coordinate of the mouse pointer is shown when you move the pointer. According to Fig. 1.29, the voltage at t = 6.228 ms is 6.889 V. The obtained voltage is quite close to the value predicted by theory.

1.2

Example 1: Simple Resistive Voltage Divider

9

Fig. 1.12 Addition of two resistors to the schematic

Fig. 1.13 Setting> Shortcut keys setting

You can use the Waveform Config icon (Fig. 1.30) to set the colors of the obtained graph. You can use the Export Waveform icon (Fig. 1.31) to save the waveform as a .csv file. The generated .csv file is saved on your computer and not on the website server. The .csv file permits you to export the obtained results into MATLAB® or Microsoft Excel® . You can use the Export Result Image icon (Fig. 1.32) to export the obtained waveform as a graphical file. The format of the exported file is Space Vector Graphics (SVG). You can use the https://convertio.co/tr/svg-bmp/ to convert the exported SVG file into.BMP file.

10

Fig. 1.14 Shortcut keys setting

Fig. 1.15 Addition of voltage source to schematic

1 Basic Concepts

1.2

Example 1: Simple Resistive Voltage Divider

Fig. 1.16 Addition of ground to schematic

Fig. 1.17 Connecting the components together

11

12

Fig. 1.18 Entering the value of components

Fig. 1.19 Completed schematic

1 Basic Concepts

1.2

Example 1: Simple Resistive Voltage Divider

Table 1.1 Available prefixes in EasyEDA Prefix

Meaning

G

Giga

Meg

Mega

K

Kilo

m

Milli

u

Micro

n

Nano

p

Pico

f

Femto

Fig. 1.20 Voltage probe

Fig. 1.21 Addition of a voltage probe to the schematic

13

14

Fig. 1.22 Name of voltage probe is changed to out Fig. 1.23 File> Save

1 Basic Concepts

1.2

Example 1: Simple Resistive Voltage Divider

Fig. 1.24 Save as a new project

Fig. 1.25 Simulation> Simulation Setting

Fig. 1.26 Transient tab

15

16

1 Basic Concepts

Fig. 1.27 Warning shown for a big timestep

Fig. 1.28 Simulation result

You can return to the schematic page by clicking on the schematic tab (Fig. 1.33). Note that the simulation command .tran 10 m is added to the schematic. This command asks the EasyEDA to simulate the behavior of the circuit for [0, 10 ms] interval. You can remove the simulation command by clicking on it and pressing the Delete key on your keyboard. You can double click on the simulation command to edit it as well. After editing the simulation command, you can click the Run icon (Fig. 1.34) to run it.

1.2

Example 1: Simple Resistive Voltage Divider

Fig. 1.29 Reading the graph

Fig. 1.30 Waveform config icon

Fig. 1.31 Export waveform icon

17

18

1 Basic Concepts

Fig. 1.32 Export result image icon

Fig. 1.33 Simulation command is added to the schematic

1.3

Example 2: Differential Voltage Measurement

The Voltage Probe block measures the voltage of nodes with respect to the ground. In this example, we see how to measure the voltage difference between two arbitrary nodes. Let’s measure the voltage of resistor R1 in the previous example. Open the schematic of the previous example and change it to what is shown in Fig. 1.35. The Net Label tool (Fig. 1.36) is used to give names “A” and “B” to the terminals of the resistor R1. A voltage-controlled voltage source block (Fig. 1.37) is used to measure the voltage difference between nodes “A” and “B”.

1.3

Example 2: Differential Voltage Measurement

19

Fig. 1.34 Run icon

Fig. 1.35 Schematic of Example 2

Fig. 1.36 Net Label tool

Click on the VCVS block. This shows the settings of the VCVC block (Fig. 1.38). Note that voltage gain is 1.

20 Fig. 1.37 VCVS block

1 Basic Concepts

1.3

Example 2: Differential Voltage Measurement

21

Fig. 1.38 VCVS settings

When you want to connect the Net Label block to the voltage-controlled voltage source E1, click on the Net Label block first and drag the mouse pointer toward the destination terminal of the E1 (Fig. 1.39). Click the Run icon. The simulation result is shown in Fig. 1.40. According to Fig. 1.40, the voltage drop across the resistor R1 is 3.128 V which is quite close to the expected theoretical value.

22

1 Basic Concepts

Fig. 1.39 Connecting the Net Label block VCVS block

Fig. 1.40 Simulation result

1.4

Example 3: Current Measurement

In this example, we want to measure the previous circuit current. Change the schematic of the previous example to what is shown in Fig. 1.41. The current is measured with a current-controlled voltage source. Click on the current-controlled voltage source to select it. After clicking on the block, its color changes to red, and its settings appear on the right side of the screen (Fig. 1.42). Note that the Transresistance box is filled with 1. So, 1 A generates 1 V at the output. Click the run icon. The simulation result is shown in Fig. 1.43. According to Fig. 1.43, the output voltage is 3.128 mV. So, the current drawn from the input source is 3.128 mA.

1.5

Example 4: Exporting the Drawn Schematic as a Graphical File

23

Fig. 1.41 Schematic of Example 3

1.5

Example 4: Exporting the Drawn Schematic as a Graphical File

You can export the drawn schematic as a graphical file. This is very useful when you want to prepare a report/presentation and you need to show the circuit schematic. In order to export the drawn schematic, click the File> Export> PNG (Fig. 1.44) and save the file in the desired path of your computer.

24

1 Basic Concepts

Fig. 1.42 CCVS block settings

1.6

Example 5: Multimeter Block

In Example 3, we learned that current-controlled voltage source block can be used to measure the circuit current. The Multimeter block (Fig. 1.45) can be used to measure the RMS value of currents and voltages.

1.6

Example 5: Multimeter Block

25

Fig. 1.43 Simulation result

Let’s study a simple example. Draw the schematic shown in Fig. 1.46. Settings of Multimeter block are shown in Fig. 1.47. Note that Ammeter is selected for multimeter type box. Run the simulation by clicking on the run icon. The simulation result is shown in Fig. 1.48. 10 = 3.125 mA. So, the Let’s check the obtained result. According to Ohm’s law, 1k+2.2k EasyEDA result is correct. Fig. 1.44 File> Export> PNG

26

1 Basic Concepts

Fig. 1.45 Multimeter block

1.7

Example 6: Sinusoidal Voltage Source

In this example, we will learn how to generate sinusoidal voltages for our simulations. Open the schematic of the previous example and left click on the voltage source V1 to select it (Fig. 1.49). This opens the settings of voltage source V1 on the right side of the screen (Fig. 1.50). Click on the Voltage Source drop-down list and select Sine (Fig. 1.51). We want to generate the v(t) = 10 + 15 × sin(2π × 60 × t + 30◦ ). Settings shown in Fig. 1.52 generate this voltage. This voltage generates i(t) = 10+15×sin(2π ×60×t+30◦ ) = 3.125 + 4.6875 sin(2π × 60 × t + 30◦ ) mA. The RMS value 1k+2.2k  of this current is (3.125 mA)2 + 21 (4.6875 mA)2 = 4.555 mA.

1.7

Example 6: Sinusoidal Voltage Source

Fig. 1.46 Measurement of current with multimeter block

Fig. 1.47 Multimeter block settings

27

28

1 Basic Concepts

Fig. 1.48 Simulation result

Fig. 1.49 Voltage source V1 is selected

Run the simulation. The simulation result is shown in Fig. 1.53. According to Fig. 1.53, the RMS of circuit current is 5.552 mA which is not correct. Note that the simulation is done at [0, 10 ms] interval. So, even one full cycle of current didn’t pass from the Ammeter. That is why the correct RMS value of the circuit current didn’t display on the screen. One cycle of circuit current takes 1/60 = 16.67 ms. Figure 1.54 shows how EasyEDA calculates the value shown in Fig. 1.53. Double click the on the .tran 10 m command and change it to “.tran 1”. Now the simulation is done on the [0, 1 s] interval. This time enough cycles are passed from the

1.7

Example 6: Sinusoidal Voltage Source

29

Fig. 1.50 Voltage source settings

Fig. 1.51 Selection of SINE for voltage source drop-down list

Multimeter block. Click the run button to start the simulation. The simulation result is shown in Fig. 1.55. The obtained value is quite close to the correct value.

30 Fig. 1.52 Entering the parameters of desired sine wave

Fig. 1.53 Simulation result

1 Basic Concepts

1.8

Example 7: Measurement of Phase Difference

31

Fig. 1.54 MATLAB commands

Fig. 1.55 Simulation result

1.8

Example 7: Measurement of Phase Difference

In this example, we want to measure the phase difference between points B and A in Fig. 1.56. The input voltage has a frequency of 60 Hz and a peak value of 1 V. From basic j×L×ω j×L×2πf j×5m×377 VA = R+j×L×2πf VA = 4+j×5m×377 VA = circuit theory, in steady state, VB = R+j×L×ω

32

1 Basic Concepts

Fig. 1.56 Schematic of Example 7

1.885j 4+1.885j VA



= 0.426ej64.76 VA . VA and VB show the phasor of the voltage of nodes A and B, respectively. So, the phase difference between points B and A is 64.76◦ . Let’s measure the phase difference with EasyEDA. Draw the schematic shown in Fig. 1.57. Settings of voltage source V1 are shown in Fig. 1.58. Run the simulation. The simulation result is shown in Fig. 1.59. We need to measure the time difference between the starting point of the two waveforms. This measurement must be done in the steady-state portion of the waveform. Let’s measure the time difference between points A and B in Fig. 1.60. Use the mouse pointer to read the coordinate of points A and B as accurately as possible. The coordinate of point A is 80.205 ms and 3.65 mV. The coordinate of point B is 83.252 ms and 3.65 mV. Fig. 1.57 EasyEDA schematic of Fig. 1.56

1.8

Example 7: Measurement of Phase Difference

33

Fig. 1.58 Voltage source settings

So, the time difference between the two waveforms is around 83.252 ms − 80.205 ms = 3.047 ms. For the calculations shown in Fig. 1.61, calculate the phase difference between the two waveforms. According to Fig. 1.61, the phase difference is 65.815° which is quite close to the value predicted by theory (64.76◦ ).

34

Fig. 1.59 Simulation result Fig. 1.60 Time difference between two waveforms

1 Basic Concepts

1.9

Example 8: Wattmeter Block

35

Fig. 1.61 MATLAB commands

1.9

Example 8: Wattmeter Block

In this example, we want to √ measure the power of the circuit shown in Fig. 1.62. The input voltage of this circuit is 120 2 sin(2×π ×60×t +45◦ ) ∼ = 169.7 sin(2×π ×60×t +45◦ ). We will use the Wattmeter block in the EELib for this purpose.

Fig. 1.62 Schematic of Example 8

36

1 Basic Concepts

Let’s start. Draw the schematic shown in Fig. 1.63. Click the run icon (Fig. 1.64). The simulation result is shown in Fig. 1.65. Let’s check the obtained result. The following MATLAB code calculates the average power, reactive power, apparent power and power factor.

Fig. 1.63 EasyEDA schematic of Fig. 1.62

Fig. 1.64 Run icon

1.9

Example 8: Wattmeter Block

Fig. 1.65 Simulation result

clc clear all f=60; Vrms=120; R1=10; L1=10e-3; w=2*pi*f; Z=R1+L1*w*j; Irms=Vrms/abs(Z); P=R1*Irmsˆ2; %average(active) power S=abs(Z)*Irmsˆ2; %apparent power Q=sqrt(Sˆ2-Pˆ2); %reactive power pf=P/S; disp(‘average power(kW) :’) disp(P/1000) disp(‘reactive power(var):’) disp(Q) disp(‘apparent power(kVA):’) disp(S/1000) disp(‘power factor:’) disp(pf)

37

38

1 Basic Concepts

Fig. 1.66 MATLAB commands

The output of MATLAB code is shown in Fig. 1.66. The obtained results show that EasyEDA results are correct.

1.10

Example 9: Observing the Power Waveform

In this example, we want to observe the waveform of instantaneous power dissipated in resistor R1 shown in Fig. 1.67. Let’s start. Draw the schematic shown in Fig. 1.68. Settings of voltage source V1 are shown in Fig. 1.69. In order to draw the waveform of power dissipated in resistor R1, we need the voltage drop across the resistor R1 and the current through it. Voltage source V2 in Fig. 1.68 measures the current that passes through the resistor. Add another voltage source to the schematic (Fig. 1.70). Select the voltage source V3 by left clicking on it (Fig. 1.71). This shows the settings of voltage source V3 on the right side of the screen. Select B for Voltage Source dropdown list and enter “v = V(A, B) * I(V2)” to the Value[A] box (Fig. 1.72). So, the voltage Fig. 1.67 Schematic of Example 9

1.10

Example 9: Observing the Power Waveform

39

Fig. 1.68 EasyEDA schematic of Fig. 1.67

Fig. 1.69 Voltage source settings

of V3 is VAB × I = (VA − VB ) × I . VA , VB and I shows the voltage of node A, the voltage of node B and the current that passes through the circuit, respectively. Different types of mathematical functions that can be used with B sources are available at http://ltwiki.org/ LTspiceHelpXVII/LTspiceHelp/html/B-device.htm.

40

Fig. 1.70 Addition of voltage source V3 to the schematic

Fig. 1.71 Voltage source V3 is selected

Fig. 1.72 Voltage source V3 settings

1 Basic Concepts

1.10

Example 9: Observing the Power Waveform

41

Fig. 1.73 Simulation> Simulation Setting

Fig. 1.74 Transient analysis settings

Click the Simulation> Simulation Setting (Fig. 1.73) and set up a transient simulation with parameters shown in Fig. 1.74. Then click the Run button. After clicking the Run button, the schematic changes to what is shown in Fig. 1.75. The simulation result is shown in Fig. 1.76. Note that the resistor power is not zero at t = 0 in Fig. 1.76. This shows that the circuit didn’t start from zero initial condition. Let’s see why? The EasyEDA does a DC operating point analysis automatically before doing the transient simulation and uses the result of this analysis as the initial condition for the circuit. When a DC operating point analysis is done, inductors are replaced with short circuits, and capacitors are replaced with open circuits. Sources have their value at t = 0. Figure 1.77 shows the circuit which is used for DC operating point analysis. The sinusoidal voltage source is replaced with a source with a value of 169.7 sin(45◦ ) = 120 V. Therefore, according to Ohm’s law, the circuit current (=initial inductor current) is 120 10 = 12 A.

42

Fig. 1.75 Transient analysis command is added to the schematic

Fig. 1.76 Simulation result

Fig. 1.77 Steady-state DC equivalent circuit of Fig. 1.67

1 Basic Concepts

1.10

Example 9: Observing the Power Waveform

43

The following MATLAB code draws the graph of instantaneous power dissipated in the resistor. Note that this code analyzes the circuit with the assumption that the initial current of the inductor is 12 A. clc clear all R1=10;L1=10e-3;f=60;T=1/f;w=2*pi*f;phi0=pi/4;Vm=169.7; syms i(t) V1(t) V1=Vm*sin(w*t+phi0); ode=L1*diff(i,t)+R1*i==V1; cond=i(0)==Vm*sin(phi0)/R1; iSol(t)=dsolve(ode,cond); pR=simplify(R1*iSolˆ2); figure(1) ezplot(pR,[0 0.02]) title(‘Instantaneous power of resistor’) grid minor

The output of the code is shown in Fig. 1.78. This is the same as the graph shown by EasyEDA.

Fig. 1.78 Output of MATLAB code

44

1 Basic Concepts

In EasyEDA, you can determine the initial conditions. Example 12 shows how to analyze a circuit with desired initial conditions.

1.11

Example 10: Thevenin Equivalent Circuit

In this example, we want to find the Thevenin equivalent circuit with respect to the terminals “a” and “b” for the circuit shown in Fig. 1.79. Let’s start. Draw the schematic shown in Fig. 1.80. Let’s measure the value of the Thevenin voltage source. The value of the Thevenin voltage source is equal to the open-circuit voltage. Connect a Multimeter block to the output

Fig. 1.79 Schematic of Example 10

Fig. 1.80 EasyEDA schematic of Fig. 1.79

1.11

Example 10: Thevenin Equivalent Circuit

45

of the circuit to measure the open-circuit voltage (Fig. 1.81). Settings of the Multimeter block are shown in Fig. 1.82. Click the Simulation> Simulation Setting and set up a transient analysis with parameters shown in Fig. 1.83. The Stop Time of transient analysis is not important since there is no capacitor and inductor in the circuit. The absence of an inductor and capacitor means that there is no transient region in the response. After clicking the Run button, the schematic changes to what is shown in Fig. 1.84. The simulation result is shown in Fig. 1.85. According to Fig. 1.85, the open-circuit voltage is VTH = Vab = Va − Vb = −5 V. It is time to measure the Thevenin resistance (RTH ). We can measure the Thevenin TH resistance with the aid of a short circuit current (ISC ). Remember that RTH = VISC . The ISC is measured with the aid of the schematic shown in Fig. 1.86. Settings of the Multimeter

Fig. 1.81 Open-circuit voltage is measured with a multimeter

Fig. 1.82 Multimeter settings

46

Fig. 1.83 Transient analysis settings

Fig. 1.84 Transient analysis command is added to the schematic

1 Basic Concepts

1.11

Example 10: Thevenin Equivalent Circuit

47

Fig. 1.85 Simulation result

Fig. 1.86 Short circuit current is measured with a multimeter

block are shown in Fig. 1.87. According to Fig. 1.86, the short circuit current is −0.05 −5V TH = 0.05A = 100 . A. So, the Thevenin resistance is RTH = VISC The Thevenin equivalent circuit for the given circuit (Fig. 1.79) is shown in Fig. 1.88.

48

1 Basic Concepts

Fig. 1.87 Multimeter settings

Fig. 1.88 Thevenin equivalent circuit of Fig. 1.79

1.12

Example 11: RLC Circuit

In this example, we want to simulate the RLC circuit shown in Fig. 1.89. The initial current of the inductor and the initial voltage of the capacitor are 2 A and 25 V, respectively. We want to study this circuit in the [0, 3 s] interval. Let’s simulate the circuit in EasyEDA. Draw the schematic shown in Fig. 1.90. In this circuit, an Electrolytic capacitor is used. Note that one of the plates of the Electrolytic capacitor has a + sign behind it. Double click on the capacitor value and add the “ic = 25” to it (Fig. 1.91). This tells the EasyEDA that the capacitor has an initial voltage of 25 V. In other words, Vterminal with + sign − Vterminal without + sign = 25 V.

Fig. 1.89 Schematic of Example 11

1.12

Example 11: RLC Circuit

49

Fig. 1.90 EasyEDA schematic of Fig. 1.89

Fig. 1.91 Entering the initial conditions of the capacitor

The initial voltage of the capacitor is entered into EasyEDA. It is time to enter the initial current of the inductor. Click the Place> Text (Fig. 1.92) and add the “.ic I(L1) = 2” to the schematic (Fig. 1.93). Left click on the added text to select it (Fig. 1.94). This shows the settings of the added text on the right side of the screen. Select the “spice” for Text Type (Fig. 1.95). The schematic changes to what is shown in Fig. 1.96. When you select “spice” for the Text Type box, the EasyEDA understands that text contains a SPICE command. The added command (.ic I(L1) = 2) tells the EasyEDA that the initial current of 2 A enters the + terminal of the inductor. When you select the inductor from EELib, the + terminal is the left terminal (Fig. 1.97a). When you press the R key on the keyboard to rotate the inductor, the positive terminal becomes the upper one (Fig. 1.97b). When you press the R key on your keyboard and after that press the X key on your keyboard to flip the part horizontally, the positive terminal becomes the upper one (Fig. 1.97c).

50 Fig. 1.92 Place> Text

Fig. 1.93 Entering the initial conditions of the inductor

1 Basic Concepts

1.12

Example 11: RLC Circuit

51

Fig. 1.94 Selection of entered text

Fig. 1.95 Text attributes

Run the simulation. The simulation result (waveform of capacitor voltage) is shown in Fig. 1.98. The maximum of this graph occurred around the t = 1.557 s and its value is 103.233 V. You can observe the circuit current with the aid of the schematic shown in Fig. 1.99. Graph of circuit current is shown in Fig. 1.100. The maximum of this graph occurred around t = 379.192 ms and its value is 24.191 A.

52

1 Basic Concepts

Fig. 1.96 Entered text is converted into a SPICE directive

Fig. 1.97 Positive direction for the inductor current

Let’s check the obtained results. From basic circuit theory, we have R.i(t) + L di(t) dt +  d 2 i(t) di(t) d 2 i(t) 1 t 1 R di(t) 1 + C i(t) = 0 ⇒ 2 + L dt + LC i(t) = 0. C 0 i(τ )d τ + V0,C = V1 ⇒ R dt + L dt dt 2 V −Ri −V0,C di(t)  100−2×2−25 = 1 0,L = = 142 As . The Initial conditions are i0,L = 2A and dt  L 0.5 t=0 following MATLAB code solves the obtained differential equation and draws the graph of capacitor voltage and circuit current over the [0, 3 s] time interval. clc clear all R=2;

1.12

Example 11: RLC Circuit

Fig. 1.98 Simulation result

Fig. 1.99 Measurement of circuit current

53

54

1 Basic Concepts

Fig. 1.100 Simulation result

L=500e-3; C=0.25; V1=100; a=R/L; b=1/L/C; syms i(t) ode = diff(i,t,2)+a*diff(i,t)+b*i == 0; Dy=diff(i,t); cond = [i(0) == 2; Dy(0)==142]; iSol(t) = dsolve(ode,cond); V0C=25; syms x VC=1/C*int(iSol,t,0,x)+V0C VC=subs(VC,x,t) figure(1) ezplot(VC,[0 3]) title(‘Capacitor voltage(V)’) grid minor figure(2) ezplot(iSol,[0 3]) title(‘Circuit current (A)’) grid minor

The output of the code is shown in Figs. 1.101 and 1.102. You can compare different points of these graphs with the EasyEDA result in order to ensure that the EasyEDA result is correct.

1.12

Example 11: RLC Circuit

Fig. 1.101 Graph of capacitor voltage

Fig. 1.102 Graph of inductor current

55

56

1 Basic Concepts

Fig. 1.103 Maximum capacitor voltage

For instance, let’s compare the maximum of obtained graphs with the EasyEDA result. According to Fig. 1.103, the maximum capacitor voltage is 103.243 V, and it occurs at 1.55889 s. According to Fig. 1.104, the maximum circuit current is about 24.1972 A, and it occurs at 381.062 ms. These values are quite close to EasyEDA results.

1.13

1.13

Example 12: Step Response of Electric Circuits

57

Example 12: Step Response of Electric Circuits

In this example, we want to draw the step response of the RLC circuit of the previous example. For step response, the initial conditions of the circuit are assumed to be zero. You can use a DC source with a value of 1 V to stimulate the circuit (Fig. 1.105). The simulation result is shown in Fig. 1.106.

Fig. 1.104 Maximum circuit current

58

1 Basic Concepts

Fig. 1.105 Schematic of Example 12

Fig. 1.106 Simulation result

Let’s check the obtained result. The following MATLAB code (Fig. 1.107) draws the step response of the given RLC circuit. The output of the code is shown in Fig. 1.108. You can compare different points of the graphs in Figs. 1.106 and 1.108 in order to ensure that they are the same.

1.14

Example 13: Impulse Response of Electric Circuits (I)

59

Fig. 1.107 MATLAB commands

Fig. 1.108 Output of MATLAB code

1.14

Example 13: Impulse Response of Electric Circuits (I)

EasyEDA can be used to draw the unit impulse response of electric circuits. In this example, we want to obtain the impulse response of an RLC circuit.

60

1 Basic Concepts

Fig. 1.109 Schematic of Example 13

Let’s start. Draw the schematic shown in Fig. 1.109. Settings of voltage-controlled voltage source E1 are shown in Fig. 1.110. V1 is a voltage source block. Its settings are shown in Fig. 1.111. Note that Voltage Source drop-down list is set to PWL. The settings in Fig. 1.111 generate the waveform shown in Fig. 1.112. The coordinate of A is (0 s, 0 V), the coordinate of B is (10 ns, 1 V), the coordinate of C is (1 ms, 1 V), the coordinate of D is (1.00001 ms, 0 V) and the coordinate of E is (10 s, 0 V). Note that the generated signal is a narrow pulse. It can simulate the role of impulse input for the circuit. The integral of the signal shown in Fig. 1.112 is 10−3 (Fig. 1.113). So, it is not a unit impulse. You can multiply the output response by 101−3 = 1000 in order to obtain the unit impulse response of the circuit. That is why the Voltage Gain box in Fig. 1.110 is filled with 1000. Another way to obtain the unit impulse response is to set the value of voltages of points B and C to 1000 V instead of 1 V.

Fig. 1.110 Settings of VCVS block

1.14

Example 13: Impulse Response of Electric Circuits (I)

Fig. 1.111 Settings of voltage source

Fig. 1.112 Waveform generated by PWL voltage source

61

62

1 Basic Concepts

Fig. 1.113 MATLAB code

The simulation result is shown in Fig. 1.114. Let’s check the obtained result. The following MATLAB code (Fig. 1.115) draws the unit impulse response of the given RLC circuit on the [0, 3 s] interval. The output of the

Fig. 1.114 Simulation result

Fig. 1.115 MATLAB commands

1.15

Example 14: Impulse Response of Electric Circuits (II)

63

Fig. 1.116 Output of MATLAB code

code is shown in Fig. 1.116. You can compare different points of the graphs shown in Figs. 1.114 and 1.116 with each other in order to ensure that they are the same.

1.15

Example 14: Impulse Response of Electric Circuits (II)

In the previous example, we used a PWL voltage source to generate an impulse signal to stimulate the circuit. You can use a PULSE voltage source block to generate an impulse as well. In this example, we want to generate the required impulse signal with the aid of a PULSE voltage source block. Draw the schematic shown in Fig. 1.117. Settings of voltage source V1 are shown in Fig. 1.118. Settings in Fig. 1.118 generate the waveform shown in Fig. 1.119. The coordinate of A is (0 s, 0 V), the coordinate of B is (10 ns, 1 V), the coordinate of C is (1 ms, 1 V), the coordinate of D is (1.00001 ms, 0 V) and the coordinate of E is (10 s, 0 V). Run the simulation. The simulation result is shown in Fig. 1.120. The obtained result is the same as the previous example graph (Fig. 1.114).

64

Fig. 1.117 Schematic of Example 14 Fig. 1.118 Voltage source settings

1 Basic Concepts

1.15

Example 14: Impulse Response of Electric Circuits (II)

65

Fig. 1.119 Impulse generated by settings of Fig. 1.118. A is (0 s, 0 V), B is (10 ns, 1 V), C is (1 ms, 1 V), D is (1.00001 ms, 0 V) and E is (10 s, 0 V)

Fig. 1.120 Simulation result

2

Three-Phase Circuits and Magnetic Coupling

2.1

Introduction

In this chapter, we will learn how to analyze three-phase circuits and circuits containing magnetic elements in EasyEDA.

2.2

Example 1: Delta-Connected Three-Phase Source

In this example, we want to see how to simulate a three-phase delta-connected source. Draw the schematic shown in Fig. 2.1. Settings of voltage sources V1, V2 and V3 are shown in Figs. 2.2, 2.3 and 2.4. Note that there is 120° of phase difference between each two sources. The small resistors R1, R2 and R3 must be put between the sources in order to solve the convergence issues. Let’s simulate a simple circuit with the delta-connected three-phase source shown in Fig. 2.1. Draw the schematic shown in Fig. 2.5. This schematic doesn’t use the wire to connect the load to the source. Six Net Port blocks (Fig. 2.6) are used to connect the load to the source. The simulation result (voltage of probes A, B and C) is shown in Fig. 2.7. Let’s check the obtained result. The following equations can be written for the circuit shown in Fig. 2.5. vG3 − vG1 vA− vG3 vA− vG1 vA + + = 0 ⇒ vA = ; R R R 3 vG2 − vG3 vB vB + vG3 vB− vG2 + + = 0 ⇒ vB = ; R R R 3

© The Author(s), under exclusive license to Springer Nature Switzerland AG 2022 F. Asadi, Electric Circuit Analysis with EasyEDA, Synthesis Lectures on Engineering, Science, and Technology, https://doi.org/10.1007/978-3-031-00292-2_2

67

68

Fig. 2.1 Delta-connected three-phase source Fig. 2.2 Settings of voltage source V1

2 Three-Phase Circuits and Magnetic Coupling

2.2

Example 1: Delta-Connected Three-Phase Source

69

Fig. 2.3 Settings of voltage source V2

vC vG1 − vG2 vC + vG2 vC− vG1 + + = 0 ⇒ vC = . R R R 3 The MATLAB code shown in Fig. 2.8 draws the graph of these equations. The output of the code is shown in Fig. 2.9. The obtained result is the same as the EasyEDA result shown in Fig. 2.7.

70

Fig. 2.4 Settings of voltage source V3

Fig. 2.5 Schematic of Example 1

2 Three-Phase Circuits and Magnetic Coupling

2.2

Example 1: Delta-Connected Three-Phase Source

Fig. 2.6 Net port block

Fig. 2.7 Simulation result

Fig. 2.8 MATLAB commands

71

72

2 Three-Phase Circuits and Magnetic Coupling

Fig. 2.9 Output of MATLAB code

2.3

Example 2: Y (Star)-Connected Three-Phase Source

Y (star)-connected three-phase source can be simulated with the aid of the schematic shown in Fig. 2.10. Settings of V1, V2 and V3 are shown in Figs. 2.2, 2.3 and 2.4, respectively.

2.4

Example 3: Coupled Inductors

73

Fig. 2.10 Y (star)-connected three-phase source

2.4

Example 3: Coupled Inductors

In this example, we will learn how to model the coupled inductors. Consider the circuit shown in Fig. 2.11. Vin is a step voltage and M is the mutual inductance between L1 and 0.9m = 0.8581. L2. The coupling coefficient between the two coils is k = √LML = √1m×1.1m 1 2 From basic circuit theory,  L1 didtL1 − M didtL2 = Vin (t) RiL2 + L2 didtL2 − M didtL1 = 0. After taking the Laplace transform of both sides,       IL1 (s) Vin (s) L1 s −Ms × = . −Ms R + L2 s IL2 (s) 0 So, 

Fig. 2.11 Schematic of Example 3

IL1 (s) IL2 (s)



 =

L1 s −Ms −Ms R + L2 s

−1

 Vin (s) . × 0 

74

2 Three-Phase Circuits and Magnetic Coupling

Vin (s) = 1s , so 

IL1 (s) IL2 (s)



 (11s+10000)×10000  =

s2 ×(29s+100000) 90000 s(29s+100000)

.

You can use the following MATLAB commands to see the time domain graph of IL1 and IL2 . s=tf(‘s’); I1=(11*s+10000)*10000/s/(29*s+100000); I2=90000/(29*s+100000); figure(1) step(I1,[0:0.003/100:0.003]),grid on figure(2) step(I2), grid on

Outputs of the code are shown in Figs. 2.12 and 2.13.

Fig. 2.12 Output of MATLAB code

2.4

Example 3: Coupled Inductors

75

Fig. 2.13 Output of MATLAB code

Let’s check the obtained results with EasyEDA. Draw the schematic shown in Fig. 2.14. Probe I1 measures the IL1 current. Settings of voltage source V1 are shown in Fig. 2.15. Note that a small resistor is put between the voltage source V1 and inductor L1. If you connect the voltage source directly to an inductor, the error shown in Fig. 2.16 appears on the screen. Put a small resistor between the source and the inductor to solve this problem. The settings shown in Fig. 2.15 generate the waveform shown in Fig. 2.17 (A = 1 V and T = 10 ms. Rise time and fall time are ignored.). This waveform plays the role of step input on the [0, 10 ms] interval. Click the Place> Text (Fig. 2.18) and add “K L1 L2 0.8581” to the schematic (Fig. 2.19). Left click on the added text to select it and select “spice” for the Text Type box (Fig. 2.20). The schematic changes to what is shown in Fig. 2.21. Run the simulation. The simulation result is shown in Fig. 2.22. Compare different points of this graph with the one shown in Fig. 2.12 in order to ensure that obtained result is correct.

76

Fig. 2.14 Drawn schematic Fig. 2.15 Voltage source V1 settings

2 Three-Phase Circuits and Magnetic Coupling

2.4

Example 3: Coupled Inductors

77

Fig. 2.16 Generated error message

Fig. 2.17 Input waveform of the circuit

Let’s observe the current IL2 . Change the schematic to what is shown in Fig. 2.23 and run it. The simulation result is shown in Fig. 2.24. You can compare different points of this graph with the graph shown in Fig. 2.13 in order to ensure that they are the same.

78 Fig. 2.18 Place> Text

2 Three-Phase Circuits and Magnetic Coupling

2.4

Example 3: Coupled Inductors

Fig. 2.19 Addition of “K L1 L2 0.8581” text to the circuit

Fig. 2.20 Conversion of “K L1 L2 0.8581” into SPICE directive

79

80

Fig. 2.21 EasyEDA schematic of Fig. 2.11

Fig. 2.22 Simulation result

2 Three-Phase Circuits and Magnetic Coupling

2.4

Example 3: Coupled Inductors

Fig. 2.23 Measurement of current IL2

Fig. 2.24 Simulation result

81

82

2 Three-Phase Circuits and Magnetic Coupling

Fig. 2.25 Schematic of Example 4

2.5

Example 4: Transformer

In this example, we want to measure the RMS of the current drawn from voltage source V1 in Fig. 2.25. The load connected to the secondary of the transformer is shown in Fig. 2.26. The impedance of this load is calculated with the aid of MATLAB commands shown in Fig. 2.27. The impedance seen from the primary side is n2 × Zin (jω) = 22 × Therefore, the RMS of current drawn from (21.1302 + 1.7998j) = 84.5208 + 7.1992j.    120 the input AC source is  84.5208+7.1992j  = 1.4146 A. Fig. 2.26 Impedance seen from secondary of the transformer

2.5

Example 4: Transformer

83

Fig. 2.27 MATLAB command

Let’s simulate the circuit with EasyEDA. Draw the schematic shown in Fig. 2.28. The transformer block can be found in the EELib section (Fig. 2.29). Transformer settings are shown in Fig. 2.30. Run the simulation. The simulation result is shown in Fig. 2.31. The obtained value is quite close to the value obtained before.

Fig. 2.28 EasyEDA schematic of Fig. 2.25

84 Fig. 2.29 Transformer section of EELiB

2 Three-Phase Circuits and Magnetic Coupling

2.5

Example 4: Transformer

Fig. 2.30 Settings of transformer T1

Fig. 2.31 Measurement of RMS of primary side current

85

3

Frequency Response and DC Sweep Analysis

3.1

Introduction

In this chapter, frequency response analysis and DC sweep analysis in the EasyEDA environment are studied.

3.2

Example 1: Frequency Response of Electric Circuits (I)

(jω) In this example, we want to obtain the VVC1 (jω) for the circuit shown in Fig. 3.1. Let’s start. Draw the schematic shown in Fig. 3.2. Settings of the input voltage source are shown in Fig. 3.3. Note that AC Amplitude and AC Phase boxes are filled with 1 and 0, respectively. This makes the amplitude and phase of the sinusoidal test signal applied to the circuit equal to 1 V and 0°, respectively. Other boxes have no effect on frequency response analysis. Click the Simulation> Simulation Settings (Fig. 3.4). This opens the Run your simulation window. Open the AC Analysis tab, do the settings similar to Fig. 3.5 and click the Run button. The settings in Fig. 3.5 draw the frequency response on the [10, 1000 Hz] interval. Increasing the number entered into the Number of points box increases the smoothness of the drawn graph. However, simulation takes more time to be finished. The Number of points = 100 is good enough for most of the circuits. After clicking the Run button in Fig. 3.5, the schematic changes to what is shown in Fig. 3.6, and after a few seconds, the result shown in Fig. 3.7 appears on the screen. The  (jω)  solid line shows the magnitude graph, i.e.,  VVC1 (jω) , and the dotted line shows the phase (jω) graph, i.e.,  VVC1 (jω) .

© The Author(s), under exclusive license to Springer Nature Switzerland AG 2022 F. Asadi, Electric Circuit Analysis with EasyEDA, Synthesis Lectures on Engineering, Science, and Technology, https://doi.org/10.1007/978-3-031-00292-2_3

87

88

3 Frequency Response and DC Sweep Analysis

Fig. 3.1 Schematic of Example 1

Fig. 3.2 EasyEDA schematic of Fig. 3.1

Let’s check the obtained result. The MATLAB commands shown in Fig. 3.8 draw the frequency response of the given circuit on the [10, 1000 Hz] interval. The output of the code is shown in Fig. 3.9. Note that the horizontal axis of Fig. 3.9 has the unit of Rad/s. Let’s change it to Hz. In order to do that, double click on the white region in Fig. 3.9. This opens the window shown in Fig. 3.10. Go to the Units tab (Fig. 3.11) and select Hz for the Frequency box (Fig. 3.12). Then click the Close button. After clicking the Close button in Fig. 3.12, the horizontal axis unit changes into Hz (Fig. 3.13). Now you can compare different points of the graph in Figs. 3.7 and 3.13 in order to ensure that they are the same.

3.2

Example 1: Frequency Response of Electric Circuits (I)

Fig. 3.3 Settings of voltage source V1

Fig. 3.4 Simulation> Simulation settings

Fig. 3.5 AC analysis settings

89

90

3 Frequency Response and DC Sweep Analysis

Fig. 3.6 AC analysis command is added to the schematic

Fig. 3.7 Simulation command

3.2

Example 1: Frequency Response of Electric Circuits (I)

Fig. 3.8 MATLAB commands

Fig. 3.9 Output of MATLAB code

91

92

Fig. 3.10 Property editor window

Fig. 3.11 Units tab of property editor window

3 Frequency Response and DC Sweep Analysis

3.2

Example 1: Frequency Response of Electric Circuits (I)

Fig. 3.12 Selection of Hz unit for frequency

Fig. 3.13 Output of MATLAB code

93

94

3.3

3 Frequency Response and DC Sweep Analysis

Example 2: Frequency Response of Electric Circuits (II)

  In this example, we want to observe the input admittance VI1(jω) (jω) of the circuit shown in Fig. 3.14. Open the schematic of the previous example and change it to what is shown in Fig. 3.15. Run the simulation. The simulation result is shown in Fig. 3.16.

Fig. 3.14 Schematic of Example 2

Fig. 3.15 EasyEDA schematic of Fig. 3.14

3.3

Example 2: Frequency Response of Electric Circuits (II)

95

Fig. 3.16 Simulation result

Fig. 3.17 Export waveform icon

We will need this graph in the next example. Let’s save it as a Comma Separated Value (CSV) file. Click the Export Waveform button (Fig. 3.17) and save it with the name Waveform.csv. Let’s check the obtained result shown in Fig. 3.16. The MATLAB code shown in Fig. 3.18 draws the input admittance of the circuit. The output of this code is shown in Fig. 3.19 (note that the unit of the horizontal axis is changed into Hz using the method described in the previous example). Now you can compare different points of this graph with the one shown in Fig. 3.16.

96

Fig. 3.18 MATLAB commands

Fig. 3.19 Output of MATLAB code

3 Frequency Response and DC Sweep Analysis

3.4

3.4

Example 3: Input Impedance of Electric Circuits (I)

97

Example 3: Input Impedance of Electric Circuits (I)

In the previous example, we draw the input admittance of a series RLC circuit. In this example, we want to draw the input impedance of the circuit studied in the previous example. We use MATLAB to draw the graph of input impedance. Open the MATLAB and click the Import Data icon (Fig. 3.20). This opens the Import Data window for you (Fig. 3.21). Open the Waveform.csv file which is generated in the previous example. After opening the Waveform.csv, the Import window appears on the screen and shows the values inside the Waveform.csv file (Fig. 3.22). Click the Import Selection button (Fig. 3.22) to import the values into the MATLAB environment (Fig. 3.23).

Fig. 3.20 Import data icon

Fig. 3.21 Import data window

98

3 Frequency Response and DC Sweep Analysis

Fig. 3.22 Reading the .csv file

Fig. 3.23 .csv file is imported into MATLAB workspace

If you double click the variable Waveform in Fig. 3.23, the values inside it appear on the screen (Fig. 3.24). The frequency column shows the frequency, DBVi shows the magnitude (in dB) and PHVi shows the phase (in degrees). You can use the dot operator to see the values inside the variable Waveform. For instance, the command in Fig. 3.25 prints the values of the DBVi column on the screen. The commands shown in Fig. 3.26 use the values in the Waveform.csv to draw the input impedance of the circuit. The output of this code is shown in Fig. 3.27. Let’s check the obtained result. The commands shown in Fig. 3.28 draw the input impedance of the circuit shown in Fig. 3.14. The output of this code is shown in Fig. 3.29 (note that the unit of the horizontal axis is changed into Hz). You can compare different points of the graph shown in Figs. 3.17 and 3.18 with each other in order to ensure that they are the same.

3.4

Example 3: Input Impedance of Electric Circuits (I)

Fig. 3.24 Data inside the waveform table

Fig. 3.25 Obtaining the data of the DBVi column

99

100

Fig. 3.26 MATLAB commands

Fig. 3.27 Output of MATLAB code

3 Frequency Response and DC Sweep Analysis

3.4

Example 3: Input Impedance of Electric Circuits (I)

Fig. 3.28 MATLAB commands

Fig. 3.29 Output of MATLAB code

101

102

3.5

3 Frequency Response and DC Sweep Analysis

Example 4: Input Impedance of Electric Circuits (II)

In the previous example, we learned how to draw the input impedance of a circuit with the aid of MATLAB. The unit of the vertical axis in the previous example is in dB. In this example, we want to change the unit of the vertical axis into Ohms. Load the Waveform.csv into the MATLAB environment and use the commands shown in Fig. 3.30 in order to draw the graph of input impedance with a vertical axis in Ohms. The output of the code in Fig. 3.30 is shown in Fig. 3.31.

Fig. 3.30 MATLAB commands

Fig. 3.31 Output of MATLAB code

3.5

Example 4: Input Impedance of Electric Circuits (II)

103

You can click on the graph to read different points of the graph. For instance, the value of the magnitude graph and phase graph at 10 Hz is 3142.79  and −85.4374°, ◦ respectively. This means that the input impedance at 10 Hz is 3142.79e−j85.4374 = 250 − 3132.8j. Let’s check the obtained result. The calculations in Fig. 3.33 calculate the input impedance of the circuit at f = 10 Hz. The obtained result is the same as the value found in Fig. 3.32.

Fig. 3.32 Output of MATLAB code

104

3 Frequency Response and DC Sweep Analysis

Fig. 3.33 MATLAB commands

3.6

Example 5: DC Sweep Analysis

DC sweep analysis permits you to change the value of a DC source (a voltage source or a current source) from a minimum value up to a maximum value with desired steps and study the effect of change on the circuit behavior. Let’s study a simple example. Draw the schematic shown in Fig. 3.34. In this example, we want to change the value of voltage source V1 from 0 V up to 10 V with 0.1 V steps and see its effect on the voltage drop of the diode. In order to Fig. 3.34 Schematic of Example 5

3.6

Example 5: DC Sweep Analysis

105

Fig. 3.35 DC sweep analysis settings

Fig. 3.36 Simulation result

do this, click the Simulation> Simulation Settings. Then open the DC sweep tab, do the settings similar to Fig. 3.35 and click the Run button. After clicking the Run button in Fig. 3.35, the result shown in Fig. 3.36 is obtained. The horizontal axis shows the V1 values and the vertical axis shows the voltage drop of the diode.

Exercises

1. (a) Find the Thevenin equivalent circuit with respect to the terminals “a” and “b” for the circuits shown in Figs. A.1 and A.2. (b) Use EasyEDA to check the result of part (a).

Fig. A.1 Circuit for part (a) of Exercise 1

Fig. A.2 Circuit for part (a) of Exercise 1

© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland AG 2022 F. Asadi, Electric Circuit Analysis with EasyEDA, Synthesis Lectures on Engineering, Science, and Technology, https://doi.org/10.1007/978-3-031-00292-2

107

108

Exercises

Fig. A.3 Circuit for Exercise 2

Fig. A.4 Circuit for Exercise 3

2. Simulate the circuit shown in Fig. A.3. Initial conditions are shown in the figure. 3. In the circuit shown in Fig. A.4, V1 = 10 + 25 sin(2π × 60t). Initial conditions are VC,0 = 10 V and i L,0 = 0 A. Use EasyEDA to observe the circuit current. 4. (a) Calculate the current i in the circuit of Fig. A.5. (b) Use EasyEDA to check the result of part (a). 5. Set up an EasyEDA simulation to measure the RMS of a triangular wave. Use MATLAB or hand calculation to verify the obtained result. Hint: Use the Function Generator block in the EELib to generate the triangular waveform. 6. Use EasyEDA to observe the unit impulse response and unit step response of the circuit shown in Fig. A.6 (output is the capacitor voltage). 7. Use EasyEDA to observe the frequency response ( Vi(in (jω) jω) ) of the circuit shown in Fig. A.7.

Exercises

Fig. A.5 Circuit for Exercise 4

Fig. A.6 Circuit for Exercise 6

Fig. A.7 Circuit for Exercise 7

109

References

1. Hayt, W., Kemmerly, J., Durbin, S.: Engineering circuit analysis, 9th edition, McGraw-Hill (2021) 2. Nilsson, J., Riedel, S.: Electric circuits, 11th edition, Pearson (2018) 3. Thomas, R. E., Rosa, A. J., Toussaint G. J.: The Analysis and Design of Linear Circuits, 9th edition, John Wiley and Sons (2020) 4. Alexander, C., Sadiku, M.N.O: Fundamentals of Electric Circuits, 6th edition, McGraw-Hill (2016) 5. Asadi, F., Essential Circuit Analysis Using NI Multisim and MATLAB, Springer (2022) 6. Asadi, F., Eguchi, K., Power Electronics Circuit Analysis with PSIM, DeGruyte (2021) 7. Asadi, F., Eguchi, K., Simulation of Power Electronics Converters Using PLECS, Elsevier (2021)

© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland AG 2022 F. Asadi, Electric Circuit Analysis with EasyEDA, Synthesis Lectures on Engineering, Science, and Technology, https://doi.org/10.1007/978-3-031-00292-2

111