Circuits I - Bison Academy

advertisement
NDSU
5. Circuits I
pg 1
Circuits I
Circuits I Concepts
Kirchoff's Current Loops (KCL)
Kirchoff's Voltage Nodes (KVN)
Writing N equations for N unknowns
Solving N equations for N unknowns
Matlab Functions
Input a matrix
inv()
plot()
mesh()
Resistor Networks & Steady-State Heat Flow
A common theme in solving problems in Electrical and Computer Engineering is to first write N
equations to solve for N unknowns. Once done, you can usually solve.
One Dimensional Heat Flow:
Suppose you want to know the temperature along a long rod with a fixed temperature at one end
finite elements
Base Temperature
T1
T2
heat flow
T3
T4
T5
T6
T7
T8
heat loss
One-dimensional heat flow. Heat flows left to right - with heat loss at each element
One way to solve this problem is to split the rod into a large number of finite element.
Each element has a temperature
Between elements is thermal conduction.
The steady-state solution is when the heat flowing into a node equals the heat flow out of a node.
The circuit equivalent for this heat-flow problem is a resistor circuit:
Voltages represent the temperature at each point along the rod and current represents heat flow
The resistors on the top model the thermal conductivity between nodes
The resistors to ground model the heat loss at each node.
NDSU
5. Circuits I
pg 2
Heat Flow
V1
V2
V3
V4
V5
V6
V7
V8
+
Vin
-
Heat Loss
Circuit model for 1-dimensional heat flow: voltages represent temperature, current represents heat flow
If you can solve for the voltages for the resistor network, you know the temeratures along the rod.
Two-Dimensional Heat Flow:
The same holds in 2-dimensions, except that you get a 2-dimensional figure for the resistor network with
the heat loss being modeled as the resistances to ground at each node.
Heat Flow
Vij
Vin
+
Heat Loss
-
Circuit for 2-dimensional heat flow. At each node, the heat (current) flowing in must balance with the heat flowing out.
Note that you can get a very large number of equations when you go to 2 or 3 dimensions - but the concept is the same as one
dimension
Note that in each case, you are trying to solve for N unknown voltages (if you care about the temperature)
or N unknown currents (if you want to know heat flow). Once you know one, you know the other - so it
doesn't really matter which one you solve for.
NDSU
5. Circuits I
pg 3
In ECE, we have two main tricks are used to write N equations for N unknowns
KCL: Kirchoff's Current Loops
KVN: Kirchoff's Voltage Nodes
Kirchoff's Current Loops (KCL):
The sum of the voltages around any closed loop must be zero. To use this method
Step 1) Draw the circuit so that there are N distinct "windows". Define the current in each window.
Step 2) Sum the voltages around each loop to zero to create N equations for the N unknown currents.
If you pass through a voltage source, add if you hit the + terminal first, subtract if you hit the terminal first.
If you pass
Special Case: If there is a current source in the circuit
The current source defines one of the currents (one equation)
The other loops cannot cross the current source since you don't know what voltage it applies.
(Current sources supply whatever voltage it takes to maintain current.)
As you go around the loop,
Example 1: Write N equations for N unknowns using KCL:
100
100
+
I1
300
200
150
I2
250
I3
-
Example 1: Solve for the currents in the circuit using KCL:
Step 1: There are three windows. Define three currents (show in red)
Step 2: Sum the voltages around each loop to write N equations for N unknowns.
I1:
−100 + 100(I 1 ) + 150(I 1 − I 2 ) = 0
I2:
150(I 2 − I 1 ) + 200(I 2 ) + 250(I 2 − I 3 ) = 0
I3:
250(I 3 − I 2 ) + 300(I 3 ) + 350(I 3 ) = 0
350
NDSU
5. Circuits I
Note: When you go around loop I1, the coefficients of I1 are all positive, all other coefficients are
negative.
Step 3: Solve. MATLAB helps here - especially if you use matrix algebra.
An nxm matrix has
n rows
m columns
When you multiply matricies, the inner coefficient must match
A 2x3 ⋅ B 3x1 = C 2x1
element cij is
c ij = Π(a ik b kj )
or for a 2x3 multiplied by a 3x1
⎡b
⎡ a 11 a 12 a 13 ⎤ ⎢ 11
⎢
⎥ ⋅ ⎢ b 21
⎣ a 21 a 22 a 23 ⎦ ⎢ b
⎣ 31
⎤
⎥ ⎡ a 11 b 11 + a 12 b 21 + a 13 b 31 ⎤ ⎡ c 11 ⎤
⎥=⎢
⎥=⎢
⎥
⎥ ⎣ a 21 b 11 + a 22 b 21 + a 23 b 31 ⎦ ⎣ c 21 ⎦
⎦
The identity matrix is analagous to the number one: it leaves a matrix unchanged
IA = A
A matrix inverse is the matrix which produces the identity matrix:
A −1 A = I
Only square matricies (NxN) can be inverted.
If you can write N equations with N unknowns as
AX = B
then you can solve for X as
X = A −1 B
Example:
-->A = rand(3,3)
0.2113249
0.7560439
0.0002211
0.3303271
0.6653811
0.6283918
-->inv(A)*A
1.
0.
0.
0.
1.
0.
0.
0.
1.
0.8497452
0.6857310
0.8782165
pg 4
NDSU
5. Circuits I
Going back to the circuit, rewrite the 3 equations with 3 unknowns as
I1:
250I 1 − 150I 2 = 100
I2:
−150I 1 + 600I 2 − 250I 3 = 0
I3:
−250I 2 + 900I 3 = 0
Place this in matrix form
⎡ 250 −150 0 ⎤ ⎡ I 1 ⎤ ⎡ 100 ⎤
⎢
⎥⎢
⎥ ⎢
⎥
⎢ −150 600 −250 ⎥ ⎢ I 2 ⎥ = ⎢ 0 ⎥
⎢
⎥⎢
⎥ ⎢
⎥
⎣ 0 −250 900 ⎦ ⎣ I 3 ⎦ ⎣ 0 ⎦
AX = B
Solve in MATLAB
-->A = [250,-150,0; -150,600,-250;0,-250,900]
250.
- 150.
0.
- 150.
600.
- 250.
0.
- 250.
900.
-->B = [100;0;0]
100.
0.
0.
-->I = inv(A)*B
I1:
I2:
I3:
0.4817150
0.1361917
0.0378310
Once you know the current you can compute the voltages.
-->V1 = 150*(I(1) - I(2))
51.828499
-->V2 = 250*(I(2) - I(3))
24.590164
-->V3 = 350*I(3)
13.240858
pg 5
NDSU
5. Circuits I
pg 6
Kirchoff's Voltage Nodes (KVN):
A second way to solve this circuit is to sum the currents to zero at each node.
Step 1: Define a ground node. Voltage means nothing without a ground reference
Step 2: Define the voltage at the other N nodes
Step 3: Write N equations for N unknowns by summing the current from each node to zero.
Step 4: Solve N equations for N unknowns.
Example: Find the voltages at each node:
100
100
+
200
V1
300
V2
150
250
-
Example: Vind the voltage at each node using KVN
Step 1: Defind ground. Already done.
Step 2: Define N votlages for N voltage nodes. Done in blue
Step 3: Write three equations for the three unknown voltages.
At node V1, the current from the load (left, down, right) must add to zero
⎛ V 1 −100 ⎞ + ⎛ V 1 −0 ⎞ + ⎛ V 1 −V 2 ⎞ = 0
⎝ 100 ⎠ ⎝ 150 ⎠ ⎝ 200 ⎠
At node V2:
⎛ V 2 −V 1 ⎞ + ⎛ V 2 −0 ⎞ + ⎛ V 2 −V 3 ⎞ = 0
⎝ 200 ⎠ ⎝ 250 ⎠ ⎝ 300 ⎠
At node V3:
⎛ V 3 −V 2 ⎞ + ⎛ V 3 −0 ⎞ = 0
⎝ 300 ⎠ ⎝ 350 ⎠
V3
350
NDSU
5. Circuits I
pg 7
Step 4: Solve. First, group terms
V1:
⎛ 1 + 1 + 1 ⎞ V 1 − ⎛ 1 ⎞ V 2 = ⎛ 1 ⎞ 100
⎝ 100 150 200 ⎠
⎝ 200 ⎠
⎝ 100 ⎠
V2:
⎛ −1 ⎞ V 1 + ⎛ 1 + 1 + 1 ⎞ V 2 − ⎛ 1 ⎞ V 3 = 0
⎝ 200 ⎠
⎝ 200 250 300 ⎠
⎝ 300 ⎠
V3:
⎛ −1 ⎞ V 2 + ⎛ 1 + 1 ⎞ V 3 = 0
⎝ 300 ⎠
⎝ 300 350 ⎠
Note that when writing the eqations for V1, all terms times V1 are positive while all other terms are
negative. This holds for all nodes.
Write in matrix form
⎡ ⎛ 1 + 1 + 1 ⎞
⎛ −1 ⎞
0
⎝ 200 ⎠
⎢ ⎝ 100 150 200 ⎠
⎢
⎛ −1 ⎞
⎛ 1 + 1 + 1 ⎞
⎛ −1 ⎞
⎢
⎝ 200 ⎠
⎝ 200 250 300 ⎠
⎝ 300 ⎠
⎢
⎛ −1 ⎞
⎛ 1 + 1 ⎞
⎢
0
⎝ 300 ⎠
⎝ 300 350 ⎠
⎣
Solve
-->A = [1/100+1/150+1/200,-1/200,0]
A =
0.0216667
- 0.005
0.
-->A = [A;-1/200,1/200+1/250+1/300,-1/300]
A =
0.0216667
- 0.005
- 0.005
0.0123333
0.
- 0.0033333
-->A = [A;0,-1/300,1/300+1/350]
A =
0.0216667
- 0.005
0.
- 0.005
0.0123333
- 0.0033333
0.
- 0.0033333
0.0061905
-->B = [1;0;0]
B =
1.
0.
0.
-->V = inv(A)*B
V =
51.828499
24.590164
13.240858
Note that this is the same result we got using KCL
⎤
⎥ ⎡ V1 ⎤ ⎡ 1
⎥⎢
⎥ ⎢
⎥ ⎢ V2 ⎥ = ⎢ 0
⎥⎢ V ⎥ ⎢ 0
⎥⎣ 3 ⎦ ⎣
⎦
⎤
⎥
⎥
⎥
⎦
NDSU
5. Circuits I
pg 8
Example 2: Determine the temperature along a long rod (1 dimensional) assuming
10 finite elements
The thermal resitance between each element is 1 degree C/Watt (1 Ohms)
The thermal loss at each element is 100 degree C / Watt (100 Ohms)
The base is held at 100C
Room temperature is 0C
1
100V
1
V1
+
1
V2
100
1
V3
100
100
1
V4
1
V5
100
100
1
V6
100
1
V7
100
1
V8
100
1
V9
V10
100
100
-
Solution: Write this in the form of
XA = B
X is the heat flow from each element. Take nove V5 for example. Summing the currents to zero (KVN)
⎛ V 5 −V 4 ⎞ + ⎛ V 5 −V 6 ⎞ + ⎛ V 5 ⎞ = 0
⎝ 1 ⎠ ⎝ 1 ⎠ ⎝ 100 ⎠
or
−V 4 + 2.01V 5 − V 6 = 0
The same pattern will hold for all 10 elements, except for the last one (where there is only one 1 Ohm
resistor attached)
−V 9 + 1.01V 10 = 0
In MATLAB, you can input this using a for statement
Start with a zero matrix with dimension 10x10
-->A = zeros(10,10);
The diagonal is -2.01. The off diagonals are +1
-->for i=1:9
-->
A(i,i) = 2.01;
-->
A(i+1,i) = -1;
-->
A(i,i+1) = -1;
-->
end
The last element is 1.01
-->A(10,10) = 1.01;
Checking it it's correct:
NDSU
5. Circuits I
pg 9
--A
2.01
- 1.
0.
0.
0.
0.
0.
0.
0.
0.
- 1.
2.01
- 1.
0.
0.
0.
0.
0.
0.
0.
0.
- 1.
2.01
- 1.
0.
0.
0.
0.
0.
0.
0.
0.
- 1.
2.01
- 1.
0.
0.
0.
0.
0.
0.
0.
0.
- 1.
2.01
- 1.
0.
0.
0.
0.
0.
0.
0.
0.
- 1.
2.01
- 1.
0.
0.
0.
0.
0.
0.
0.
0.
- 1.
2.01
- 1.
0.
0.
-->V = inv(A)*B
92.673872
86.274482
80.737837
76.008571
72.03939
68.790603
66.229722
64.331139
63.075867
62.451353
A graph shows the cooling of the bar as you go along a little better:
-->plot([0:10],[100;V],'.-')
-->xlabel('Finite Element');
-->ylabel('Voltage (V)');
0.
0.
0.
0.
0.
0.
- 1.
2.01
- 1.
0.
0.
0.
0.
0.
0.
0.
0.
- 1.
2.01
- 1.
0.
0.
0.
0.
0.
0.
0.
0.
- 1.
1.01
NDSU
5. Circuits I
pg 10
Homework:
1) Use KCL to write N equations for N unknowns for the following circuit
2) Solve for the currents and voltages in MATLAB
3) Use KVN to write N equations for N unknowns for the following circuit
4) Solve for the node voltages in MATLAB.
100
100
+
200
V1
I1
150
300
V2
250
I2
400
V3
350
I3
V4
I4
450
-
Problem 1-4
5) Determine the temperature along a metal rod with
10 finite elements
The resistance between elements is 2 Ohms
The resistance between each element and ground is 50 Ohms.
2
100V
+
2
V1
50
2
V2
50
2
V3
50
2
V4
50
2
V5
50
-
Problem 5
2
V6
50
2
V7
50
2
V8
50
2
V9
50
V10
50
Download