Author Topic: Mesh analysis  (Read 52856 times)

0 Members and 6 Guests are viewing this topic.

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #25 on: December 29, 2016, 01:23:23 pm »
so does the voltage go into the equation at all ? I'll have another go shortly
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Mesh analysis
« Reply #26 on: December 29, 2016, 01:39:43 pm »
If you mean the V3=20/45 voltage source, it is needed in the equations to solve the circuit. If you forget the -5i impedance from a to b for a moment (it does nothing but letting pass a constant current, it is completely dominated by V3), then V3 must let pass enough current to make sure that, from a to b, there is a voltage equal to 20/45.  The amount of that current is determined by voltage V3. So V3 will go into your system sooner or later.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #27 on: December 29, 2016, 03:24:40 pm »
right so what decides if it is 120-N1 or N1-120, this is the sirt of thing that confuses me.
 

Offline jm_araujo

  • Regular Contributor
  • *
  • Posts: 77
  • Country: pt
Re: Mesh analysis
« Reply #28 on: December 29, 2016, 03:34:04 pm »
That one I remember :D

You do. You define the orientation of the currents going into and out of the node. If you where wrong, you will get a negative result  (going the other way)when solving the system. Just be consistent in all the equations.

I hope it makes sense, it's kind of hard to explain without visual aids, and on non native language.
 
The following users thanked this post: orolo

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #29 on: December 29, 2016, 03:44:21 pm »
so if I assume currents going into the node external voltages will be higher and the node voltage is subtracted from the external voltage. If the current is coming out of the node the node would be at a higher voltage so the fixed external voltages are subtracted from the node voltage. Would that be correct?
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Mesh analysis
« Reply #30 on: December 29, 2016, 03:51:26 pm »
You can imagine the direction you choose for the current as the probes in a multimeter. If you swap them, the measured current changes sign, but the real current stays the same. The change in sign in the measured current compensates inverting the probes.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #31 on: December 29, 2016, 04:06:52 pm »
yes my problem is making sure I get everything going in the same direction.
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Mesh analysis
« Reply #32 on: December 29, 2016, 04:17:58 pm »
As Araujo said, choose the orientations of the current as you see fit, and make a drawing to be sure you keep consistent (I did that in a drawing above). If, after solving for that random orientation, you get a negative current in some net, you know that the real current runs opposite to your randomly chosen direction.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #33 on: December 29, 2016, 04:41:15 pm »
So now I am at the attached. I'm not sure it wiull give the same result as for the mesh method but I've given up giving a shit.
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Mesh analysis
« Reply #34 on: December 29, 2016, 05:30:43 pm »
The equations are not consistent, dimensionally. b - (14.14 + 14.14·i) is measured in volts, so it's not a current. The problem, like in your previous attempt, is trying to measure the current through V3 using some variation of Ohm's law.

Since V3 is from a to b, you are given the fact a - b = V3 as a present, so that should be one of your equations. Now take the two nodal equations, one for a and one for b, and use them to obtain a single equation in 'a' and 'b' with the current through V3 removed. There you have two linear equations in a and b, which solve the problem.

Edit:

Anyway, I've solved the problem both in mesh and node, and got the same results:

I1 = 16.81123818 - 22.87925079 J
I2 = 25.96293849 - 40.15475552 J
I3 = 18.05884700 - 22.0959085   J
I4 = 28.79136562 - 42.98318264 J
a  = 86.37752364 + 45.75850157 J
b  = 72.23538800 + 31.61636595 J

------

Mesh equations  (using Maple):

eq1 :=   0 = -120 + 2*I1 - (5*I)*(I1-I2) ;
eq2 :=   0 = -(5*I)*(I2-I1) - (5*I)*(I2-I4) + (4*I)*(I2-I3) ;
eq3 :=   0 = (4*I)*(I3-I2) + 4*I3+120*I ;
eq4 :=   0 = -(5*I)*(I4-I2) + (1+I)*(20*sqrt(2)*(1/2)) ;

evalf(solve([eq1, eq2, eq3, eq4]));

{I1 = 16.81123818-22.87925079*I, I2 = 25.96293849-40.15475552*I, I3 = 18.05884700-22.09590851*I, I4 = 28.79136562-42.98318264*I}

To get voltage at nodes a, b, we compute:

a =  120 - 2*I1 = 120 - 2*(16.81123818-22.87925079*I) = 86.37752364+45.75850158*I
b =  120*I + 4*I3 = 120*I+4*(18.05884700-22.09590851*I) = 72.23538800+31.61636596*I

-------

Now for the node, we have three equations:

eq5 :=   a - b = (1+I)*(20*sqrt(2)*(1/2)) ;    # V3 is a current source from b to a.

eq6 :=   (120-a)*(1/2) + k + (1+I)*(20*sqrt(2)*(1/2))/(5*I) = a/(-5*I) ;  # Node a.

eq7 :=   (120*I-b)*(1/4) = k + b/(4*I) + (1+I)*(20*sqrt(2)*(1/2))/(5*I)  ;  # Node b.

evalf(solve([eq5, eq6, eq7]));

{k = -28.79136562+42.98318264*I, a = 86.37752364+45.75850157*I, b = 72.23538800+31.61636595*I}

Note that the current k through V3 is -I4 in the mesh analysis.
« Last Edit: December 29, 2016, 06:43:03 pm by orolo »
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Mesh analysis
« Reply #35 on: December 29, 2016, 07:04:04 pm »
Sorry for the saturation. If you want to model this thing, set the frequency to 1/2Pi, so omega=1. Then the 4J impedance are 4 Henries, and the -5J impedance are 1/5 = 0.2 Farads. So you get something like the attached model. I've tested the RMS values, and they hold rather well.

This thing is rather technical and very sensible to the tiny mistakes.  :phew:

 

Offline snarkysparky

  • Frequent Contributor
  • **
  • Posts: 441
  • Country: us
Re: Mesh analysis
« Reply #36 on: December 29, 2016, 07:34:42 pm »
Phheewww.  Let me put in my two cents worth.  After all I worked on it for a few hours.

Spice seems to verify.  I only solved for three currents but the others come easily from them.

 
The following users thanked this post: orolo

Offline kulky64

  • Regular Contributor
  • *
  • Posts: 61
  • Country: sk
Re: Mesh analysis
« Reply #37 on: December 29, 2016, 08:55:33 pm »
I don't understand why orolo and snarkysparky reversed the direction of arrow on all voltage sources from original OP's direction. I respected OP's arrow directions and got this:

 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #38 on: December 29, 2016, 10:40:17 pm »
Maple ? is that easier to use than wolfram alpha where you sign up to ine thing as it's all thats on offer and then find you should buy something else? Seems to be a lot of maple versions out there.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #39 on: December 29, 2016, 10:41:36 pm »
Sorry for the saturation. If you want to model this thing, set the frequency to 1/2Pi, so omega=1. Then the 4J impedance are 4 Henries, and the -5J impedance are 1/5 = 0.2 Farads. So you get something like the attached model. I've tested the RMS values, and they hold rather well.

This thing is rather technical and very sensible to the tiny mistakes.  :phew:



Yes that is true, never thought of that, was anicking over the stupid maths. So after 2 days at this hardly solved one question, uh maybe one day they will let me study transistors!
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Mesh analysis
« Reply #40 on: December 29, 2016, 11:26:10 pm »
Maple ? is that easier to use than wolfram alpha where you sign up to ine thing as it's all thats on offer and then find you should buy something else? Seems to be a lot of maple versions out there.
Maple is a symbolic algebra package, similar to Wolfram's Mathematica and venerable Maxima (and superior to both, at least for pure math work, IMHO). A Maple license is expensive, but Maxima is free. I have also heard very good things about SageMath, but didn't find the time to mess with it. Anyway, if I were to solve lots of equations I'd download wxmaxima (maxima + graphical interface), which I deem more versatile than Wolfram's online tools.

For example, I downloaded wxmaxima and translated the mesh problem in a few moments: maxima declares variables with ':' and represents the imaginary unity as %i:

Code: [Select]
eq1 :   0 = -120 + 2*I1 - (5*%i)*(I1-I2) ;
eq2 :   0 = -(5*%i)*(I2-I1) - (5*%i)*(I2-I4) + (4*%i)*(I2-I3) ;
eq3 :   0 = (4*%i)*(I3-I2) + 4*I3 + 120*%i ;
eq4 :   0 = -(5*%i)*(I4-I2) + (1+%i)*(20*sqrt(2)*(1/2)) ;

res : solve([eq1,eq2,eq3,eq4]);

expand(float(res));

The answer being:

[[I4=28.79136561796584-42.98318264169568*%i,I3=18.05884700508457-22.09590851186492*%i,I2=
25.96293849321965-40.15475551694949*%i,I1=16.81123817796539-22.87925078813564*%i]]

Very easy to modify and play with.



 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 10088
  • Country: us
Re: Mesh analysis
« Reply #41 on: December 31, 2016, 12:41:23 am »
Maple ? is that easier to use than wolfram alpha where you sign up to ine thing as it's all thats on offer and then find you should buy something else? Seems to be a lot of maple versions out there.
Maple is a symbolic algebra package, similar to Wolfram's Mathematica and venerable Maxima (and superior to both, at least for pure math work, IMHO). A Maple license is expensive, but Maxima is free. I have also heard very good things about SageMath, but didn't find the time to mess with it. Anyway, if I were to solve lots of equations I'd download wxmaxima (maxima + graphical interface), which I deem more versatile than Wolfram's online tools.

For example, I downloaded wxmaxima and translated the mesh problem in a few moments: maxima declares variables with ':' and represents the imaginary unity as %i:

Code: [Select]
eq1 :   0 = -120 + 2*I1 - (5*%i)*(I1-I2) ;
eq2 :   0 = -(5*%i)*(I2-I1) - (5*%i)*(I2-I4) + (4*%i)*(I2-I3) ;
eq3 :   0 = (4*%i)*(I3-I2) + 4*I3 + 120*%i ;
eq4 :   0 = -(5*%i)*(I4-I2) + (1+%i)*(20*sqrt(2)*(1/2)) ;

res : solve([eq1,eq2,eq3,eq4]);

expand(float(res));

The answer being:

[[I4=28.79136561796584-42.98318264169568*%i,I3=18.05884700508457-22.09590851186492*%i,I2=
25.96293849321965-40.15475551694949*%i,I1=16.81123817796539-22.87925078813564*%i]]

Very easy to modify and play with.

I decided to follow the same path with wxMaxima/Maxima, copied your code block and got the same answers.  Looking at the results of res = ..., I sure wouldn't want to do this by hand!

I have also found Microsoft Mathematics (free) to be useful as is GNU Octave.  I didn't try to solve this problem using either program because the equation notation for Maxima seems more intuitive.

The thing I find staggering is that, once upon a time, I used to do this stuff with a sliderule.  Calculators (like the HP35) didn't come out until my senior year.  I didn't have one but I certainly admired the capability.  I did have a plug-in 4 function calculator but it was pretty useless.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #42 on: December 31, 2016, 11:51:30 am »
Microsoft mathematics seems user friendly. Unless i use software to solve it I will never get it done as with complex numbers it's just not going to happen and I'd need to solve every iteration that I come up with until I get an answer.
 

Offline kulky64

  • Regular Contributor
  • *
  • Posts: 61
  • Country: sk
Re: Mesh analysis
« Reply #43 on: December 31, 2016, 12:26:31 pm »
Matlab is pretty elegant too:
Code: [Select]
format long

V1 = 120; V2 = 120i; V3 = 20*(cos(pi/4)+i*sin(pi/4));
Z1 = 2; Z2 = -5i; Z3 = 4; Z4 = -5i; Z5 = 4i;

Z = [Z1+Z4     -Z4        0      0;
      -Z4    Z2+Z4+Z5    -Z5   -Z2;
       0       -Z5      Z3+Z5    0;
       0       -Z2        0     Z2];
V = [-V1; 0; V2; V3];

I = inv(Z)*V
I_modulus = abs(I)
I_angle = rad2deg(angle(I))
Results:
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 10088
  • Country: us
Re: Mesh analysis
« Reply #44 on: December 31, 2016, 04:25:40 pm »
Matlab is pretty elegant too:
Code: [Select]
format long

V1 = 120; V2 = 120i; V3 = 20*(cos(pi/4)+i*sin(pi/4));
Z1 = 2; Z2 = -5i; Z3 = 4; Z4 = -5i; Z5 = 4i;

Z = [Z1+Z4     -Z4        0      0;
      -Z4    Z2+Z4+Z5    -Z5   -Z2;
       0       -Z5      Z3+Z5    0;
       0       -Z2        0     Z2];
V = [-V1; 0; V2; V3];

I = inv(Z)*V
I_modulus = abs(I)
I_angle = rad2deg(angle(I))
Results:

That's really slick!  I own a copy of Matlab and have been using the Simulink package to play around with analog computing.  I can even add knobs and dials to my models.  It works really well!  For some reason, I have been fooling around with differential equations for the last couple of years.

However, I have absolutely no knowledge of Matlab itself so replicating your example was interesting.  Obviously I got the same results but the thing I like is how clean the input is.  It is really easy to follow along with the equations.

Where this becomes important is finding a math package that will be useful to my grandson as he wanders through college.  I'm looking at Matlab, Octave, Maximua, Microsoft Mathematics and I'll probably find a couple of others.  It's a given his major won't be Mathematics and it probably won't be EE.  Right now he's looking at Economics (math will be useful) or Software Engineering (I don't see math as a major component).  Apparently, he will be required to take math up through Differential Equations regardless of the major.

I need to try and keep up!

Completely off topic, here is the Simulink diagram for the Predator-Prey problem in differential equations:


« Last Edit: December 31, 2016, 04:45:47 pm by rstofer »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #45 on: December 31, 2016, 04:27:26 pm »
Well I've decided to guve up, I have some equations, some sort of a result and have wasted too much time on it already. All I need to do is get a pass, tick the box and get on with life.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 10088
  • Country: us
Re: Mesh analysis
« Reply #46 on: December 31, 2016, 05:11:24 pm »
Well I've decided to guve up, I have some equations, some sort of a result and have wasted too much time on it already. All I need to do is get a pass, tick the box and get on with life.

I think the exercise is to write the loop and node equations.  Solving them is a computer process where there is little 'electronics' learning but it does require stumbling through the User Manual.  Unfortunately, these problems won't be in the Quick Start Guide (if one exists) so it can take a little effort.

It looks to me like you have the right equations and that was the point of the exercise (I think...).

I learned (relearned?) a lot by following along.  One thing I relearned is the foibles of using the arctan() function on a calculator.  In the Matlab solution, if you take the last current (approx -28.8+43.0i) and stuff that into a calculator as real numbers, you will get an angle of -56 degrees (more of less).  Note that Matlab got the proper answer of about 124 degrees (180 degrees away) and you can see that 124 is correct if you plot the value on the x-i plane. The domain of arctan() is -90 deg .. +90 deg.  I need to remember that!

If your calculator can do complex arithmetic (like my HP 48GX and MANY others), you will get the correct answer as did Matlab.

The elegance on the Maxima and Matlab solutions is just awesome!  I wish we had had this type of thing when I went to EE school.  I could have spent more time on concepts and less time enjoying my sliderule.  I need to spend more time with these packages!

« Last Edit: December 31, 2016, 05:14:04 pm by rstofer »
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Mesh analysis
« Reply #47 on: December 31, 2016, 05:18:38 pm »
Well I've decided to guve up, I have some equations, some sort of a result and have wasted too much time on it already. All I need to do is get a pass, tick the box and get on with life.
What is the problem, exactly? For the node equations, you need to measure the currents entering/leaving each node. When a resistor connects two nodes, you can use Ohm's law, I = V/R, so you implicitly do the substitution. Instead, if a current source like V3 connects two nodes, you can't use Ohm's law beacuse it's a voltage source, not a resistor. So you need to use the the voltage source defining equation, a-b=V3, and from there obtain the current across V3.

Think in terms of nodes and the elements that connect them. Imagine two nodes, a and b, and some element that joins them. Depending on the connecting element, you get an equation:

Connected by a resistor R -->  I_ab = (V_b - V_a) / R
Connected by a current source Is --> I_ab = Is
Connected by a voltage source V --> a - b = V

The problem with the last case is that you don't have I_ab in the equation, so obtaining the current for that node is a bit more indirect. In the other cases, you just substitute I_ab directly into the nodal equation, without thinking about it.

Post your equations, it's a pity you give up on the problem. These things become routine, once the pieces click in.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Mesh analysis
« Reply #48 on: December 31, 2016, 05:54:12 pm »
Well for the nodal analysis the voltage source throws it right out. The resistance is 0 and you can't devide by 0 to get the current. I can't put a voltage into the equation. So does that make it a system of 3 equations ? I can add a "k" to take up the extra current but my knowledge of math is not enough to tell me if I am formulating dit right. I can simulate the hell out of it but that won't give me the equations. if I use a "k" I need to have a third equation for anything to want to solve it for me which would be V1-V2=14.14+i14.14.

Yes the whole point is to find the equations not show the working out, the tutor has already said he only want to see that I have understood how to do it, but I have not because all of the pages of mathematical drivel I have read is only for simpler examples and this is a whole new concept. I have a simialr thing with a delta star question where now they want to know the power which they have not explained so I might as well ditch this course material and use seperate books (and this drivel costs nearly £500 a module up from £200 a few years ago, what I get for my employers money other than the act of marking an assignment is a mystery to me)

I could ignore the extra voltage source perhaps and work only in terms of the node I need to find the voltage at.

My assumption is something like:

for left node = x, right hand node = y and the mystery current = k

left node: (120-x)/2 + (0-x)/(-i5) + k + (-14.14-i14.14)/(-i5) = 0

right node: (i120-y)/4 + (0-y)/4 + k + (14.14+i14.14)/(-i5) = 0

the third equation to shut the software up: x-y=14.14+i14.14

The result of that in microsoft mathematica is attached - I'm sure this is yet another version of the many I have tried and might have done a better job this time as the difference between the voltages at the nodes actually looks like 14.14+i14.14
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: Mesh analysis
« Reply #49 on: December 31, 2016, 06:18:19 pm »
Ok, at first sight, you forgot the imaginary unit at: (0-y)/4, which should be (0-y)/(4I). The rest is formally correct, let me solve it to see if it works, I haven't checked the current directions for consistency.

Edit: The current k is inconsistent, because it enters one node and leaves the other. So in one nodal equation you must use k, and in the other -k. With that, your equations give the correct results.

Instead of using the idea: the sum of all currents is zero, it is best to give an orientation to each wire, and use for each node: sum of incoming currents = sum of outgoing currents. From there, the opposite signs for k (and for 14.14 + 14.14J, which you did well) are obvious.
« Last Edit: December 31, 2016, 06:26:54 pm by orolo »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->