Lab #3-3 - lab report PDF

Title Lab #3-3 - lab report
Course Engineering Circuit Analysis I
Institution University of California Riverside
Pages 10
File Size 365.1 KB
File Type PDF
Total Downloads 49
Total Views 151

Summary

lab report...


Description

Lab 3: Simulation of Electric Circuits with Matlab and Pspice

EE 001 LA Engineering Circuit Analysis I Department of Electrical Engineering University of California – Riverside

Name: Shawn Fleisher SID:  862007897 Partner: Merril Ghabour Professor: El-Sherief Section: 006 TA: Ahmed Table: 13

1. Introduction: The objectives of this lab are to explore the difference between modeling and simulation, the usage of simulation and modeling software for electric circuit analysis, usage of matlab for symbolic and numerical simulation of electric circuits , usage of PSpice for electric circuit simulation, and PSpice simulation of electric circuits containing dependent sources.

2. Theory: Matlab and PSpice perform simulations to calculate values of Kirchoff's Current and Voltage Laws. In the Matlab’s solution, Vout is a fraction of Vin as expected for Vr2= (R2/(r1+r2))Vs. Also, if a statement of any electric circuit problem does not specifically ask for the value of reference voltage/currents, then we have to obtain actual voltages and currents. If as a result of an electric circuit solution the sign of a reference voltage/current is negative, then the reference voltage/current is opposite in sign but same in magnitude with respect to the reference parameter. If it is not negative, then it is the correct value. 3. Design Calculations and Circuit Schematics: 1.3 Laboratory Procedures Matlab simulatio n

VS

VR1

VR2

iS

iR1

iR2

Symbolic

Vs= Vs

-(R1Vs) / (R1+R2)

(R2Vs) / (R1+R2)

Vs / (R1+R2)

- Vs / (R1+R2)

Vs / (R1+R2)

Numerica l

10

-3.1973

6.8027

0.68027

-0.68027

0.6827

3. Vout= (R2 / (R1+R2)) Vin Vout= (10/ 5.1+10) (10) = 6.62 Vin Since Vout  is < Vin , we know that the voltage divider equality holds. 6. Modified Symbolic Code: % ee001la_Lab3_Part1_voltage_divider_symbolic.m % -----------------------------------------------------------------------------------clear vS vR1 vR2 vR3 iS iR1 iR2 iR3 VS R1 R2 R3; % clear symbolic variables

% ----- Declare symbolic variables and circuit parameters ----------------------------syms v S vR1 vR2 vR3 iS iR1 iR2 iR3; % unknown reference voltages and currents syms V  S R1 R2 R3;

% known circuit component parameters

% ----- Write KCL, KVL, i-v equations --------------------------------------------eq_node1 = 'iS + iR1 = 0' ;

% KCL node 1

eq_node2 = 'iR2 - iR3 -iR1=0' ;

% KCL node 2

eq_node3 = '-iS - iR2 + iR3 = 0' ;

% KCL node 3

eq_loop1 = '-vS + vR1 + vR2 = 0' ;

% KVL loop 1

eq_loop2 = 'vR2 +vR3 = 0'

%  KVL loop 2

eq_loop3 = '-vs + vR1 - vR3 = 0'

% KVL loop 3

eq_iv_VS = ' vS = VS' ;

% i-v characteristic of the voltage src

eq_iv_R1 = 'vR1 - R1*iR1 = 0' ;

% i-v characteristic of R1

eq_iv_R2 = 'vR2 - R2*iR2 = 0' ;

% i-v characteristic of R2

eq_iv_R3 = 'vR3 - R3*iR3 = 0' ;

% i-v characteristic of R3

% ----- Solve symbolically the system of linear equations ------------S= solve(eq_node1,eq_node2,eq_node3,eq_loop1,eq_loop2,eq_iv_VS,eq_iv_R1,eq_iv_R2, eq_iv_R3, vS, vR1, vR2, vR3, iS, iR1, iR2 ,iR3); % ----- Solutions can be obtained by accessing fields in the S structure disp('vS =') , disp(S.vS) disp('vR1 ='), disp(S.vR1) disp('vR2 ='), disp(S.vR2) disp('vR3='), disp(S.vR3) disp('iS =') , disp(S.iS) disp('iR1 ='), disp(S.iR1) disp('iR2 ='), disp(S.iR2) disp('iR3 ='), disp(S.iR3)

Table 1.3 : Matlab Simulation

VS [V]

VR1 [V]

VR2 [V]

VR3 [V]

Symbolic

Vs= Vs

(Vs(R1R2+ R  1+R3))/ (R1R2+ R1R3+ R2R3)

(Vs(R2R3)) / (R1R2+ R1R3+ R2R3)

- (Vs(R2R3)) / (R1R2+ R1R3+ R2R3)

Numerical

10

6.1466

3.8534

-3.8534

Lab 2, Parts 1.3 & 2.3

-10

6.178

3.874

-3.874

% deviation from experiment

0%

0.51 %

0.53%

0.53%

Table 1.3 continued :

Matlab Simulation

iS

iR1

iR2

Symbolic

-(R2Vs+R3Vs))/ (R1R2+ R1R3+ R2R3)

(R2Vs+R3Vs))/ (R3Vs))/ (R1R2+ R1R3+ R2R3) (R1R2+ R1R3+ R2R3)

iR3 -(R2Vs))/ (R1R2+ R1R3+ R2R3)

Numerical

1.2

-1.2

-0.4

0.8198

Lab 2, Parts 1.3 & 2.3

1.2235

1.2262

.3974

.8321

% 1.92% deviation from experiment

2.13%

0.65%

1.48%

8. Modify ee001la_Lab3_Part1_voltage_divider_numeric.m so that the code solves the system of linear equations as in 7., and re-run commands in Listing 1.5. Record the results in the “Numerical” raw of the previous table Modified Numerical Code: % ee001la_Lab3_Part1_voltage_divider_numeric.m % --------------------------------------------------------------------clear v S vR1 vR2 vR3 iS iR1 iR2 iR3 VS R1 R2 R3; variables

% clear symbolic

% ----- Set circuit parameters -----------------------------------VS = 10 ;

% voltage source, [V]

R1 = 5100 ;

% resistor, [Ohm]

R2 = 10000 ;

% resistor, [Ohm]

R3 = 4700 ;

% resistor, [Ohm]

% ----- Form matrix A -------------------------------------------A=[ 0

0

0

0

1

1

0

0 ; . . .

0

0

0

0

0

-1

-1

1

1

0

0

0

0

0 ; . . .

0

0

1

1

0

0

0

0 ; . . .

1

0

0

0

0

0

0

0 ; . . .

0

1

0

0

0 -R1 0

0 ; . . .

0

0

1

0

0

0 -R2 0 ;

0

0

0

1

0

0

1 -1 ; . . .

0 -R3]

% ----- Form b, the RHS ----------------------------------------b=[ 0

0

0

0

VS 0

0

0] ' ;

% ----- Compute the inverse of A ------------------------------%Ainv = inv(A) % ----- Find the solution of the system of equations ----%x = Ainv * b; x = A \ b;

% uncomment this line if needed

% ----- Assign the result to reference variables ----------vS = x(1) vR1 = x(2) vR2 = x(3) vR3 = x(4) iS = x(5) iR1 = x(6) iR2 = x(7) iR3 = x(8)

9. The results obtained for the symbolic and numerical Matlab code are similar. The values recorded for the voltages across all elements are within 0.1 V, and the values recorded for the current across all elements are within 0.2 mA.

10. The results for the numerical and symbolic solutions from Matlab are similar. The results from Matlab compared to the experimental results we got in parts 1.3 and 2.3 of Lab 2 are similar. The percent deviation from the experimental results in Table 2.2 are below 2%. This shows that our theoretical results and experimental results are similar, and within the range for accurate results.

Experiment, Matlab , PSpice, Simulation

Actual VS [V]

Actual VR1 [V]

Actual VR2 [V]

Actual VR3 [V]

Symbolic

Vs= Vs

(Vs(R1R2+ R  1+R3))/ (R1R2+ R1R3+ R2R3)

(Vs(R2R3)) / (R1R2+ R1R3+ R2R3)

- (Vs(R2R3)) / (R1R2+ R1R3+ R2R3)

Numerical

10

6.1466

3.8534

-3.8534

PSpice

10.0

6.147

3.853

-3.853

Lab 2, Part 1.3 , 2.3

-10

6.178

3.874

-3.874

% deviation of PSpice results from experiment

0%

0.50%

0.54%

0.54%

Experiment, Matlab, PSpice simulation

iS

iR1

iR2

iR3

Symbolic

-(R2Vs+R3Vs))/ (R1R2+ R1R3+ R2R3)

(R2Vs+R3Vs))/ (R1R2+ R1R3+ R2R3)

(R3Vs))/ (R1R2+ R1R3+ R2R3)

-(R2Vs))/ (R1R2+ R1R3+ R2R3)

Numerical

1.2

-1.2

-0.4

0.8198

PSpice

1.205

1.205

0.3853

0.8199

Lab 2, Part

1.2235

1.2262

.3974

.8321

1.3, 2.3 % deviation of PSpice results from experiment

1.51%

1.73%

3.044%

1.47%

25. The accuracy we can claim would be 95% because the PSpice answers compared to the experimental measurements had a deviation of less than 5%. This means that PSpice is close to the original predictions and is accurate. Practical Problems Encountered and Resolved: The problem we had in this lab was getting the Matlab code to work. We would enter the code that was given and receive syntax errors. Our TA helped clarify what we needed to change, we adjusted our code accordingly, and then got the results we needed. Conclusion: This lab taught us some of the uses of PSpice and Matlab for the simulation of electrical circuit. This lab showed us that we could use a simulation to get fairly accurate results rather than needing to gather experimental data. This also showed us how we could use simulations to validate our experimental data or vice versa. Using this along with our knowledge of KCL and KVL, we were able to take the data recorded from Lab 2 and confirm the results obtained from Lab 2. This lab gave us a first hand experience of why simulation is used before experiments are done.

EE01LA Prelab #3 1. How do you understand the concept of a physical property modeling? a. My understanding of physical property modeling is to use mathematical or visual representations of a concept for computations or concept explanations. 2. What is the difference between modeling and simulations? a. The difference between modeling and simulations are that a model is the use of anything to represent something, while a simulation is a process of using a model to study the behavior, states, or performance of an actual system . 3. In your opinion, what are the advantages and disadvantages of using Matlab for electric circuit simulations? a. The advantages of using Matlab for electric circuits are that the program can easily calculate large matrices and that it also allows for users to change the parameters from new calculations without being time consuming. The disadvantages of using Matlab for electric circuit simulations are that the program itself does not solve for the actual values of the circuit , meaning if the user makes a mistake while coding then the output will be incorrect too. 4. What is the purpose of a voltage divider circuit? Design a circuit which would provide an output voltage Vout = 3V from a voltage source V in = 10V assuming that power consumption of all resistors cannot exceed 1/4W. a. The purpose of a voltage divider circuit is to reduce the output voltage to a fraction of the input voltage.

5. Using the Nodes and Branches Method (NBM) pre-compute a system of linear equations for the electric circuit in Figure 1.5. which was used in Lab 2 and will also be used in the computer experiments of this lab. Assume reference voltage polarities and reference current directions as shown in the figure. a) Vr1+Vr2=10=Vs

b) 5.1ir1+10ir2=-10=-Vs c) -Vr2=Vr3 d) 4.7ir3+10ir2=0 e) ir1=iS 6. Which type of simulations, symbolic or numerical, is more suitable for the design of electric circuits? Why? Symbolic because electric circuits have many components(resistors, capacitors, inductors, etc.) so numerical representations of these components would not be ideal. Using symbolic simulations allows us to determine the exact function of each element within the circuit and calculate the values of resistance, voltage and current. 7. Which of the two types of circuit simulations does the simulation of electric circuits by PSpice resemble more - symbolic or numerical? Numerical because variables do not depend on each other. In PSpice, the circuit components are given numerical values....


Similar Free PDFs