Mech First Order LR Circuit_1

Use this page in conjunction with Tom Brown's page at "First Order LC Circuit".

This circuit at www.falstad.com/circuit/ is the reference circuit that this page will use.

 Copy the below text into your clipboard, load the Falstad link, click "file", click "Import from text", paste the below text into the drop down box, click Ok and you should see the circuit. You should also be able to edit the circuit.

[This "circuit text" is from Tom Brown's comment below. It has been edited to change the resistor and voltage values. Now currents are scaled to SIM initial values. (4/16/16 4:55 PM edit)]

$ 1 0.001 9.001713130052181 20 25 43
s 496 192 496 144 0 1 false
w 496 224 496 192 0
v 496 288 496 224 0 0 4 40 0 0 0.5
w 496 144 704 144 0
r 704 144 704 240 0 0.163
r 768 352 768 144 0 0.26
w 768 144 704 144 0
w 544 352 496 352 1
w 496 352 496 288 1
x 566 392 646 395 0 14 i3b = G = BY
x 783 321 821 324 0 14 i2 = G
x 638 221 674 224 0 14 i1 = H
w 768 416 704 416 2
r 496 416 704 416 0 0.26
w 704 352 656 352 2
w 496 352 496 416 1
x 564 326 641 329 0 14 i3a = H = AY
l 704 240 704 352 0 1 7.63683875896101e-25
x 370 290 491 293 0 14 i3 = Y = AY plus BY
x 718 365 757 368 0 10 Scope 1
p 544 352 656 352 0
w 544 352 544 368 0
w 656 352 656 368 0
r 656 352 544 352 0 0.163
p 656 368 544 368 0
p 768 352 704 352 0
w 768 352 768 416 0
x 580 374 619 377 0 10 Scope 2
o 25 64 0 34 0.0000762939453125 0.00009765625 0 -1 Roger's Scope 1
o 24 64 0 34 0.0000762939453125 0.00009765625 1 -1 Roger's Scope 2


_____________________________________________________________
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

A solution can be found at http://banking-discussion.blogspot.com/p/first-order-lc-circuit-1.html. This solution is correct but is unclear. Figure 1 will be useful toward better understanding the solution.
Figure 1. A Wheatstone Bridge analogy for the SIM problem.

An economy is often measured by total output defined as GDP. In Figure 1, GDP is represented by the term Y. GDP is often broken into Government (G) and Household (H) sectors.

In the SIM problem, the size of the government sector is defined as a ratio to output. The size of the household sector is assumed to be the remainder after the government ratio is subtracted. From Figure 1, for unit Y,

Y = BY + (1 - B)Y                                                                                          (1)

where (1-B) = A.

Equation 1 can be rearranged to write

Y == Y[B + (1 - B)]   (== intended to mean the triple-bar identity symbol)  (2)

which is the form found in the solution referenced.

[Economist often write "H + G = Y" when they mean "H + G = Y[B + (1 - B)]". The first term is only true for the stable economy. Usually, the economy is unstable so the second term should be used.]

In the SIM problem, the (1-B) term was modified by term alpha1 to modify the amount of respending in the annual GDP measured economy.

28 comments:

  1. Roger, very good, I tried it out, and it works, and your labels are there.

    Some suggestions:

    1. Label the scopes so I can tell what they're measuring. Or take a screen capture, bring it into power point (or the Google equivalent) and label everything there, and post an image of that. Also there are parameters in the scopes themselves. I turn on "Show peak value" so it shows a number indicating the current value in the corner, and says if it's a voltage or a current. Then I turn off the 2nd curve (it shows both voltage and current by default... I'm only interested in one or the other... and the second curve just adds confusion IMO). All my scopes have only two check marks checked in their options table: "Show Peak Values" and either "Show current" or "Show voltage" ... and frankly, I couldn't seem to make most of those options work for me, so I'm not sure what they all are supposed to do. So if you figure it out, let me know (look at some of their examples under the circuits menu: they look pretty good).

    2. Adjust the time step (under "other options") and simulation speed so that the dynamics are apparent... everything now just looks like a step function (except one that's a spike), which isn't a surprise because the resistors are large. Even when I slow it way down, it's just a step. Remember Tc = L/R, so that's going to be small in your case with those large resistors. And be sure to say what 1-period is equal to... 1 usec? 1 msec?... you're not going to get to 1-second order of magnitude with those values of L and R.

    Alright, well, very good, some progress. Nice! BTW, your confusion might be helped a bit by the way Nick Edmonds stated it (I showed him the circuit too).

    Nick's statement gets right to the heart of the instantaneous vs averaged (over a sliding time-window 1-period long) statement I've been making.

    So in other words, recall that G, T and Y (and YD and C) are all quantities integrated over a sample period. Nick (and other SFC modelers I guess) call those "flows." Nick states that by saying they only exist between two times. H is fundamentally different (a "stock"). H does make sense to speak about at any one particular time. What we're doing in this circuit is constructing instantaneous currents (and 1 voltage (G)) that match those window integrated values at the sample times.

    We can also construct curves which are the "true" instantaneous rates, that we'd then have to integrate over a sliding sample period to match G&L's answers, but our 4x1 Cm and Dm state space measurement matrices would be slightly different if we did that (different than I have them in SIM7 or SIM8 or pretty much any of my SIM posts, except the latest one (SIM9)). I haven't gotten around to posting what those differences are yet (but I have them worked out)... that's what my SIM9 post is all about. I used those relations to construct some of those curves.

    ReplyDelete
    Replies
    1. But the upshot is, it doesn't matter too much. Those differences are small, and you'd never notice by looking at the plots unless you studied it carefully. However your circuit is so "fast" I don't see any dynamics at all, other than a step function for all the curves (and the one spike). But maybe that's what you intended... I'm not sure.

      OK, so what you have is 20V driving two parallel paths (in steady state) each of which have a total of 300 ohms. Thus i3a_ss = i3b_ss = 20/300 = 66.67 mA = 1/2 the current through the battery (i1?). (where ss = steady state). One of the scopes is the current through the battery (133.33 mA). The spike is cause by looking at the brief difference in voltage (with the scope probes) between the two paths caused by the inductor. The effects from this brief transient are soon over, thus it appears to be a spike.

      Also, regarding the labels, you can change the font size so they fit better next to what you want them to label. Then you can copy and paste them (so you don't have to change the size every time), using that strange procedure: copy with context menu, paste with CNTRL-V.

      Frankly I found working with their labels to be kind of painful to do.... so if you just want to make a static key or describe in some text somewhere what the scopes are doing, that works for me. I kind of figured it out on my own in this case. Actually, I noticed that if you try to move a scope, it moves the component. I thought that was annoying at first, but now I realize that the purpose it to let you know what it is the scope is measuring. The bummer is it makes it tough to reorder the scopes (I just erase them all and start over).

      One last suggestion: you probably already do this, but you can work in full screen mode and it makes it a bit easier. It's easy enough for the user to switch to full screen mode, so that's not a biggie.

      OK, I look forward to the next iteration, because I'm sure you didn't intend for Y = G, right?

      Delete
  2. Hi Roger, it looks better.

    I was wondering why your circuit looked so white. It's because you turned off the "Show Voltage" on the top menu I guess, right?

    Is that what you intended to do?

    I know my suggestions above were pretty verbose (sorry about that!)... but I was thinking of just turning off the voltage (or current) in each scope depending on what you wanted to show with it, not for the whole picture. That way the scopes will indicate the value of the current (or voltage, if you leave that on) in the upper left corner of each scope.

    Maybe you don't like it this way, I'm not sure, but it's an idea: I turned the coloring of wires back on (Voltage check box at the top), so maximum voltage is green, 0 Volts is gray and negative voltages are red. Also I turned it off in one of your scopes (Scope 1, on the left). I also turned the current off in Scope 3, I labeled your scopes, and I turned on "Peak value" in each scope, so the value currently being plotted of the curve shows in the upper left of each scope.

    Again, I have no idea if you want it like that or not, just a thought. I notice that Scope 2 is really just i1, however the way the circuit is right now, that happens to also equal i3a and i3b.

    OK, it's looking better! I like the smaller labels. It's clearer what they are labeling (especially i1). Also, I made those changes in full screen mode... I don't know how it will look in the smaller format, perhaps terrible. Here's the text file:

    $ 1 0.002 9.001713130052181 46 25 43
    s 528 240 528 192 0 1 false
    w 528 272 528 240 0
    v 528 336 528 272 0 0 4 20 0 0 0.5
    w 528 192 736 192 0
    r 736 192 736 288 0 200
    r 800 464 800 192 0 200
    w 800 192 736 192 0
    w 576 400 528 400 0
    w 528 400 528 336 0
    r 576 400 688 400 0 100
    x 598 440 678 443 0 14 i3b = G = BY
    x 815 369 853 372 0 14 i2 = G
    x 670 269 706 272 0 14 i1 = H
    p 736 400 736 464 0
    w 800 464 736 464 2
    r 528 464 736 464 0 100
    w 736 400 688 400 2
    w 528 400 528 464 2
    x 596 374 673 377 0 14 i3a = H = AY
    l 736 288 736 400 0 1 0
    x 402 338 523 341 0 14 i3 = Y = AY plus BY
    x 70 640 268 643 0 16 Scope 1: i3 = Y = AY plus BY
    x 556 645 664 648 0 16 Scope 2: i1 = H
    x 710 434 765 437 0 10 Scope 3 (V)
    x 932 646 991 649 0 16 Scope 3
    o 3 64 0 33 10 0.2 0 -1
    o 4 64 0 33 10 0.1 1 -1
    o 13 64 0 34 10 0.00009765625 2 -1

    Also you can "stack" the scopes. If you look at some of the author's examples, he uses that feature to good effect in some cases, but I didn't use it.

    It looks to me like you're trying to nail down the steady state behavior first? I'm not sure.

    A couple of questions:

    1. Why Scope #3 (on the right)? What are you showing with that one? That's the one that shows no current, and just a brief spike in voltage (down or up) when the switch is closed or opened (respectively). I understand that's where the meter in a Wheatstone bridge would go, but what are you showing with it here?

    2. I assume you're not worrying about the inductor too much at this point (since it looks like steady state is your concern), true?

    3. It looks to me like you could accomplish the same thing with just a single 300 ohm resistor in each path at this point (other than the voltage spike in Scope 3 when the switch is flipped). Why divide it into four resistors?

    4. Am I asking too many questions at too early of a stage of development?? .... Do I need to take a chill pill? Lol

    Also, I like the screen capture here. It gives you something to talk to in the text, which you've done.

    ReplyDelete
    Replies
    1. Also, I notice in their Wheatstone bridge circuit (I modified it slightly by turning on the "Show current" on at the top), they just have a horizontal wire bridging the two halves (where your Scope 3 is)... and the total resistance in the left half is different than the total in the right half, but the ratios on both sides between top and bottom resistances are the same... thus the voltage divide is perfect on both sides, and no current flows through the bridge. I guess that's the point, eh? (or one configuration possible anyway).

      Delete
    2. Well, I just tested my modifications of your latest... and it kinda worked... the scope labels drifted up and to the right a bit from where I had them. Oh well... it's not perfect.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Ah, so A = B = 0.5 the way you have the model right now, correct?

    Back in the comments section on my post you wrote:

    "All my solution says is that Y is a ratio to the sum of H and G in the SIM model."

    Is that what you mean? Does that sentence describe your equation (1)?

    ReplyDelete
    Replies
    1. Tom, I left comments at http://banking-discussion.blogspot.com/p/first-order-lc-circuit-1.html

      The Falstad circuit tool is wonderful software but I find it frustrating to use. I tried to add a switch to the Gov branch but then it acts like an open circuit someplace. Frustrating.

      Your circuit works well but stops when I try to edit. I will take a break.

      Delete
    2. I was frustrated at first too. Make sure the two end points of the circuit element you add are not red in color (red squares). That's an indication that the circuit element is not connected properly (even though it may look like it). Usually there's a message on the screen somewhere telling you this if you try to run the circuit. Also, you cannot connect to the middle of a wire. It looks like it's connected, but if you look carefully you'll see the red squares. You need to shorten wires to make a new connection (rather than try to connect in the middle of a wire), and then just add a new wire to close the gap left. Do you see what I mean?

      Suppose you have an existing horizontal wire like this:

      -

      And you want to connect a new vertical wire to it like to make a T shape. It won't work. You can draw the T shape but it won't be connected. To make a connection, you need to shorten the horizontal wire to make a gamma shape like this: Γ

      Then you add a new horizontal bit to form your T again. So in other words a "T" shaped connection is always 3 wires, never 2. I don't know if that's one of your frustrations, but it was one of mine.

      Delete
    3. ... the other thing that continues to frustrate me is forgetting that I'm in "element draw mode" rather than select mode.

      So when in doubt hit your space bar! It's the quick and easy way to get out of draw mode. And like I say you can tell by how your cursor looks... but I still stumble on that one! Lol.

      Delete
  5. Roger, here's you model with scope labels right inside each scope. I left the old labels there (but you may want to erase them, since they don't exactly land right above each scope where I'd intended they be). In order to label the scopes in this way, I edited the text directly: I don't see an option for it from within the website. The edits are what I appended to each of the last three lines. Those lines begin with "o" and prior to my edits, they ended with "-1" (but now they end with my appended text AFTER the "-1").

    $ 1 0.002 9.001713130052181 46 25 43
    s 528 240 528 192 0 1 false
    w 528 272 528 240 0
    v 528 336 528 272 0 0 4 20 0 0 0.5
    w 528 192 736 192 0
    r 736 192 736 288 0 200
    r 800 464 800 192 0 200
    w 800 192 736 192 0
    w 576 400 528 400 0
    w 528 400 528 336 0
    r 576 400 688 400 0 100
    x 598 440 678 443 0 14 i3b = G = BY
    x 815 369 853 372 0 14 i2 = G
    x 670 269 706 272 0 14 i1 = H
    p 736 400 736 464 0
    w 800 464 736 464 2
    r 528 464 736 464 0 100
    w 736 400 688 400 2
    w 528 400 528 464 2
    x 596 374 673 377 0 14 i3a = H = AY
    l 736 288 736 400 0 1 0
    x 402 338 523 341 0 14 i3 = Y = AY plus BY
    x 70 640 268 643 0 16 Scope 1: i3 = Y = AY plus BY
    x 556 645 664 648 0 16 Scope 2: i1 = H
    x 710 434 765 437 0 10 Scope 3 (V)
    x 932 646 991 649 0 16 Scope 3
    o 3 64 0 33 10 0.2 0 -1 Scope #1: i3 (Y)
    o 4 64 0 33 10 0.1 1 -1 Scope #2: i1 (H)
    o 13 64 0 34 10 0.00009765625 2 -1 Scope #3

    ReplyDelete
    Replies
    1. Also, on the menu at the top under "Edit", the last option is "Center circuit" which is nice: it just moves the whole circuit to the middle of your screen (I notice they tend to drift away from the center the more they are exported as text).

      Delete
  6. Tom, Thanks for your comments. I have a little familiarity with antenna modeling software and this circuit software is a distant cousin. Some similarity and lots of deviation.

    Thanks for the very helpful hints, especially about the space bar.

    ReplyDelete
  7. Roger, I see you did have the time step at 2 ms, which was good for circuit time constants on the order of 1 sec to 10 secs, but not for time constants on the order of < 1 usec, which is what you had with multi-Meg ohm resistors and a 1 H inductor. Tc = L/R, right? So in your case you had Tc on the order of < (1 H)/(1 Meg ohm) = 1 usec.

    The result was the numerical integration wasn't behaving properly in the simulation and it appeared that your circuit was ringing, which can't happen unless you have a second order circuit (like if you added a capacitor), but clearly a circuit with just an inductor and some resistors will be 1st order, and cannot ring (in terms of system theory, it's pole(s) (plural if you had more than one inductor) must be on the negative real axis)).

    So I edited your circuit and replaced dividing you resistance values by 10 million, so now instead of 1.63 M ohms, you have 163 m ohms (milli-ohms) = 0.163 ohms.

    This gives you a time constant (Tc) on the order of several seconds.

    Also a couple of other tips:

    1. If you don't like the polarity of your scope measurement, remove the circuit element it's measuring, and turn it around 180 degrees. Unfortunately this doesn't seem to work for scope probes that are aligned vertically (like you Scope 1: yeah, I went ahead and called it that... the scope on the left... the one measuring the element on the right), so I re-aligned your vertically aligned scope probe to be horizontal, so I could flip it around and measure positive voltages.

    The other probe I could flip no problem. Although that brings me to the 2nd point:

    2. You probably put that other probe in there to be explicit about what you were measuring (Scope 2 I called it), but just so you know, when it's across an element like that (a single resistor in your case) you don't need an explicit probe: you can just select the element of interest (right click on it) to bring up on the context menu and then select "Show in scope." Again, you probably already knew that... but just in case you didn't.

    So anyway, here's my modified version:

    $ 1 0.001 9.001713130052181 20 25 43
    s 496 192 496 144 0 1 false
    w 496 224 496 192 0
    v 496 288 496 224 0 0 4 40 0 0 0.5
    w 496 144 704 144 0
    r 704 144 704 240 0 0.163
    r 768 352 768 144 0 0.26
    w 768 144 704 144 0
    w 544 352 496 352 1
    w 496 352 496 288 1
    x 566 392 646 395 0 14 i3b = G = BY
    x 783 321 821 324 0 14 i2 = G
    x 638 221 674 224 0 14 i1 = H
    w 768 416 704 416 2
    r 496 416 704 416 0 0.26
    w 704 352 656 352 2
    w 496 352 496 416 1
    x 564 326 641 329 0 14 i3a = H = AY
    l 704 240 704 352 0 1 7.63683875896101e-25
    x 370 290 491 293 0 14 i3 = Y = AY plus BY
    x 718 365 757 368 0 10 Scope 1
    p 544 352 656 352 0
    w 544 352 544 368 0
    w 656 352 656 368 0
    r 656 352 544 352 0 0.163
    p 656 368 544 368 0
    p 768 352 704 352 0
    w 768 352 768 416 0
    x 580 374 619 377 0 10 Scope 2
    o 25 64 0 34 0.0000762939453125 0.00009765625 0 -1
    o 24 64 0 34 0.0000762939453125 0.00009765625 1 -1

    ReplyDelete
    Replies
    1. Here's the exact same thing, only I've manually edited the last two lines to label them "Roger's Scope 1" and "Roger's Scope 2" (unfortunately that's the only way to get the labels embedded in the scopes themselves):

      $ 1 0.001 9.001713130052181 20 25 43
      s 496 192 496 144 0 1 false
      w 496 224 496 192 0
      v 496 288 496 224 0 0 4 40 0 0 0.5
      w 496 144 704 144 0
      r 704 144 704 240 0 0.163
      r 768 352 768 144 0 0.26
      w 768 144 704 144 0
      w 544 352 496 352 1
      w 496 352 496 288 1
      x 566 392 646 395 0 14 i3b = G = BY
      x 783 321 821 324 0 14 i2 = G
      x 638 221 674 224 0 14 i1 = H
      w 768 416 704 416 2
      r 496 416 704 416 0 0.26
      w 704 352 656 352 2
      w 496 352 496 416 1
      x 564 326 641 329 0 14 i3a = H = AY
      l 704 240 704 352 0 1 7.63683875896101e-25
      x 370 290 491 293 0 14 i3 = Y = AY plus BY
      x 718 365 757 368 0 10 Scope 1
      p 544 352 656 352 0
      w 544 352 544 368 0
      w 656 352 656 368 0
      r 656 352 544 352 0 0.163
      p 656 368 544 368 0
      p 768 352 704 352 0
      w 768 352 768 416 0
      x 580 374 619 377 0 10 Scope 2
      o 25 64 0 34 0.0000762939453125 0.00009765625 0 -1 Roger's Scope 1
      o 24 64 0 34 0.0000762939453125 0.00009765625 1 -1 Roger's Scope 2

      Delete
    2. One other oddity I noticed: the command on the Edit menu to center the circuit didn't seem to work for me this time on your circuit, so I did a "select all" (from the Edit menu) followed by a "Draw->Drag->'Drag Selected'" from the Draw menu to manually recenter it. Your monitor may have a different aspect ratio than mine, so you may need to do something similar to get it back to the center of your screen... but I'd try the "Center Circuit" command first... that's always worked for me before, so I don't know what was different this time.

      Delete
    3. One last thing: if you can't seem to flip a part around 180 degrees, just delete it and get a new one. That happened to me.

      Delete
    4. Thanks Tom. I already tried the new circuit. It works just fine.

      I kind of liked the ringing because it filled the display to make it more prominent. LOL

      What is next? This still isn't what you were looking for, or so it seems to me.

      I spent a few minutes applying Eq. 1 to the Flow of Funds data. I used three fixed possibilities and compared the results to the velocity of M1, M2, and MZM. My fixed velocity was far less than the velocity of the M's but nothing should be read into this. My effort was too feeble and amateurish to even begin to build a case. But you must start someplace. Lol

      I certainly appreciate your hints on operating the Falstad device. I am all ears but sorry, no notable newly discovered observations to pass back. I did use the select all tool in the edit box to select the entire screen for re-centering. Then I had a hard time deselecting the whole thing, finally succeeding with some mysterious sequence (which went unrecorded!).

      Lots of fun. LOL

      Delete
    5. Roger, I had the same problem de-selecting. I still don't know what it was I did to de-select. Perhaps selecting "Draw a wire" and drawing one? I don't know.

      Delete
    6. Roger, check it out: I updated mine with a SPDT switch so that the time constant doesn't change when the switch is opened: now taxes do eat away at Y just like they should when G goes to 0. Previously because the leg of the circuit with the battery in it was switched out completely, the time constant (L/R) changed because R changed from L's point of view. You could tell because the rate of "attack" (the rise time) was much slower than the rate of "decay" (the fall time). Now they are equal, and Y and T no longer just fall to zero either... they behave like they should: an initial step down, followed by exponential decay of the right speed (matching that of H). I updated the link at the top of my post to be the same one I gave you here.

      You write:

      "What is next? This still isn't what you were looking for, or so it seems to me."

      Don't worry about what I was looking for. What are YOU looking for? What is your goal with this circuit? I changed things and made suggestions just based on my guesses about what you were looking to do.

      I'll be happy to help however I can, but I'm a little unclear on your goals.

      Delete
    7. Tom, you are a wonderful tutor and mentor. I have learned so much over the last few days. Thanks!

      One problem I would like to help solve involves Nick Edmond's material. He builds a model but it is very hard to get into a spreadsheet. It is hard mostly because of the need to iterate. Of course, we turn spreadsheet iteration on but the real problem is the intricacy of the steps. It all becomes obscure to the beginner very quickly.

      It seems to me that Eq. 1 is simple even if hard to understand (that difficulty has been proved to me over the last few days! LOL). I think with just a little more step-by-step instructions, a beginner could put together a working model of the economy. At least people could begin discussions from a common reference place, like we have done using the SIM model.

      I think anything I would build would still be SIM in nature but hopefully without the iteration.

      Perhaps the draft article should have title words including words "spreadsheet ready". Perhaps I am overreaching but maybe someone else will improve on our work. I think I'll drop the Object GDP reference, for lack of adding much to the advancement of understanding. Our interaction has really solidified my understanding of SFC models, with learning never complete.

      So maybe a turning point. I also have an antenna project with the goal of writing an article for the QST ham magazine. I am about half way on the project and next is to build a 20 meter version. I have a 2 meter beam that works very well but the concept should be tried on a bigger antenna outside.

      I'll start another comment on your circuit change.

      Delete
    8. Roger, check out my #3 above (text version) now: I have subscripts and arrows in my labels, so I don't need to bring it into Powerpoint to add that stuff (although I might anyway).

      I put all those subscripts and arrows (unicode) in my "useful symbols" side-bar... and I segregated the one that doesn't play nice (𝕀) with the others because I got tired of replacing the ?? symbol every time I did an edit.

      Delete
    9. This comment has been removed by the author.

      Delete
  8. Ah, and thanks for your kind words. When you say "iterate" you don't mean the normal iteration like SIM does, right? With SIM you can calculate by iteration or by formula (since it has a closed form solution at any step as well). SIM, run iteratively, just requires a single calculation per time step.

    I think what you mean is iteration like Nick Edmonds sometimes does where for any one time step multiple iterations are required, right?

    Well that's where Octave is going to be a BIG help. It has a general non-linear function solver you can use for that very thing and make it a snap.

    However, if you want to do it in Excel, I've been down that road myself two years ago and I have a post on it here. And no, you can't use the File->Options->Formulas->'Enable iterate calculation' there (AKA "tâtonnement"), for reasons I explain in that post.... but basically it's because each set of iterations has to be done before moving on to the next time step. If each time step was independent from the others, you could use Excel's built in tâtonnement (or their similar root finder they call "Goal Seek" or their built in vector non-linear function solver they call "Solver"). Both Goal Seek and Solver require a free add in I think (free once you buy the non-free version of Excel). All that stuff is useful, but you'll still plod along manually invoking those tools to solve one time step at a time. Unless you write Visual Basic code ... which is what Nick does... he sent me his Excel file once (for the same model my post is about) when I asked how he calculated his results.

    So anyway, I undertook to produce a reusable vector non-linear function solver that could be coded up in the free online version of Excel (similar to Google's version). So I didn't have Goal Seek or Solver or Visual Basic at my disposal, nor would the cell iterator (what I (and economists) call tâtonnement) do me any good because of the nature of the problem, even though tâtonnement was available I think, even in the free version (again, they don't call it that... it's on that menu I list above).

    So what did I do? I coded up my own vector Newton's method for solving non-linear equations using free-Excel! It was quite a challenge, but I worked hard to make it general purpose and re-usable (as much as possible). How could I do it? I fixed the number of iterations ahead of time at 6. Why 6? It seemed to work well... plus you could extend it. Newton's method converges quickly in general, provided you start off near the solution and there's a strong x^2 component in the non-linear function you're solving. Since the solution at the prior time step wasn't too far away in general, you did have a nice guess at where to start, so for the particular model I used it on, it worked great!

    My goal was to make it easy enough to use so that Nick might be able to use it to make his posts interactive. I don't think he was too impressed though. And probably rightly so... despite my efforts to make it reusable, it still isn't very easy to use I fear, and he questioned the value of making his posts interactive in the first place (he had a point there I think!).

    So follow that link to my post and check it out. I have an extensive write up on how it works there and how to reuse it, and of course you can download the spreadsheet and look at it yourself in the usual way. It shouldn't require any extra Excel packages (if I recall correctly).

    I'll be happy to answer your questions on it should you have any.

    However, I think you're going to be much better off using Octave. It's MUCH more natural to program that kind of thing with.

    ReplyDelete
    Replies
    1. Newton's method converges in 1-step if the non-linear function is *only* quadratic (no higher power terms). In my post I link to above about Nick's model I link to an animation of how it works on a Wikipedia page. They only show a scalar version of it, but you'll get the idea.

      Delete
  9. Hi Roger, I saw that you changed the model with what I had in the comment. I saw you also left my Scope Labels in at the bottom (Roger's Scope 1 and 2)... it won't hurt my feelings if you want to edit that model however you want though... including more descriptive names for the scope... but remember, you have to edit it in the text... I couldn't figure out a way within the simulator to even add labels like those.

    ReplyDelete
  10. Hey Roger, I discovered you can change the voltage or the waveformm of the voltage source on the fly while the model is running. For example, try this. Just right click on the voltage source and edit it how you like. You can even put multiple sources in series to make very complex looking waveforms.

    ReplyDelete