Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I recently encountered a really strange programming error in MCD11. A calculation of the sum of three terms only includes the first two; the third term seems to be ignored. When the calculation is simply repeated, in what should be a second identical calculation , replacing the result with the (supposedly identical) new result, the repeat calc now gives the correct answer.
The program is a simple transmission line simulator, which I was originally running with 1000 time points and 100 spatial points along the T-line. I was able to keep the error behavior using 6 time points and 4 spatial points.
The attached program and pdf show the behavior. Referring to the pdf, on page 1 is the original program on the left (with the error) and the modified program (that works) on the right. The only difference is the repeat of the calculation line for vn(kt,Nline). This term is the sum of three other terms – as shown. I spent a lot of time troubleshooting the program when I realized it was not working properly. I eventually found that the calc for vn(kt,Nline) was not giving the correct result, without any clues as to why. I eventually tried brute force – simply repeat the line. This is done in the program on the right.
The main outputs of the program are the two 2-D arrays vp (the +z travelling wave) and vn (the –z travelling wave). Rows represent time and columns represent position on the line. The source position is at the left side of the array; the load at the right side. The term vn(kt,Nline) is the start of the reflected wave at the load end, which then propagates to the left. These arrays are shown on pg 2 of the pdf, with annotation showing the three terms of the calc and how they should contribute to the newly calculated array element. What appears to be happening in the original program is that the last term of the calc - (0.99)∙ vn(kt-1, Nline) – is not included in the sum (resulting in 0.05). Simply repeating the calc line makes it work correctly (resulting in -4.9). Prior to this point, the third term contribution is zero, so the error has no effect. Since none of the three terms in the sum are modified during the calc, immediately repeating the calc should give the same result.
Pg 3 of the pdf shows a version where the result of the first calc is stored before the calc is repeated, and the second calc result is also stored. Both are then returned, showing that they are not the same.
Am I missing something simple that is causing this behavior, or is it truly a bug? I can’t see any reason why my original program shouldn’t work. In decades of using MCD11, this is the strangest thing I have encountered. I can’t escape the feeling that something simple is wrong in the program, but I can’t see what it is.
Lou
It may be a bug in MC11 which is fixed in later versions. Can't test in MC11 but your sheet looks OK and calculates without errors in MC15.
Hi Lou,
Confirmed.
I get the same error when I split the assignment in two parts:
But, with the opposite arrangement:
the error's gone.
As well as with:
No clue what the underlying mechanism could be.
When I switch the calculation mode from 'Higher speed' to 'Backward compatibility' both programs turn in error.
Success!
Luc
Hello @LouP,
It looks like you have some responses from some community members. If any of these replies helped you answer your question please mark the appropriate reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Community Moderation Team.