-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix problem in state estimation #1
base: master
Are you sure you want to change the base?
Conversation
It seems that there is a bug in computing the S matrix that affects the compulation of the derivative matrix H. As, such a new function has been developed to compute S. Moreover, the code is hardwired to solve the problem 6.7 in the book "Computational Methods for Electric Power Systems" by Mariesa Crow, 1st edition. In particular, it only accepts the measurements in that problem. So, the code is expanded to accommodate any sets of measurements. A test file "test_se_Ex_6_17.m" is provided that solves example 6.17 in the above 2nd edit of the book. The file shows the difference in computing H between the original, which is edited to allow more measurements, and the modified code. The modified code produced results that coincide with the solution of example 6.17 in the book.
Moving MATPOWER/matpower-extras#6 here, since this is the master repo for the state estimation code. It's just pulled in as a subrepo over there. |
Thanks again, @aldalahmeh, for this contribution. I finally have a chance to begin reviewing it for inclusion in the next release. But rather than merging this pull request directly, which simply adds some new files, I would like to merge your fixes into the existing files. However, before I do that, I'd like to get a better understanding of exactly what issues are being addressed. Keep in mind that the state estimation code was contributed, so I'm not as familiar with it as I am with the MATPOWER code I wrote myself. If I understand correctly, from your comments and going through the code changes, it seems there are five primary changes in
Finally, what is the effect of these changes/fixes on the other examples, e.g. Once again, @aldalahmeh, thanks for the contribution. |
Dear @rdzman , I hope that my contribution is useful for the community. I reply to your points below in order:
The final outputs of |
Thanks, @aldalahmeh, for your response. Here is some more discussion on each of the points, in order.
Thanks again, and hopefully we can sort these things out and finalize any updates to the SE code. |
Certainly. Please share what you think is missing that could be helpful. |
@rdzman In response to the interesting points you have raised:
Consider the nonlinear functions h_2(x), h_3(x), h_4(x) and h_5(x), where the measurements (z) are power measurements being power flows (with some abuse of defition) e.g. P_13 & Q_21 or power demands (P_3 & Q_2). Note in the case of h_2(x) and h_3(x), there exit terms involving the square bus voltages, which cannot be computed using original code Conceptually, h_2(x), h_3(x), h_4(x) and h_5(x) are power flows. Let us take P_13 for example. It is in fact the power flow from bus 1 to bus 3 (see snapshot below) minus the power demand at the bus it self (hence the squared bus voltage term). So I computed the complex power flow matrix What it does is computes the complex power flow as described above, where the first term is the power flow between the buses and the second term is the bus power (demand). |
|
Case (c) is implemented, as you noted earlier, in
I believe the issue here is the way the
I believe is difficult to change the way
I think you are referring to adding the voltage and magnitude of the same bus as a measurement, in which the rank will be affected. In contrast to adding them as states. However, as you states, input from a practitioner is always informative.
I agree with you that the book's notation is rather confusing. In LSE literature a weighing matrix is used and usually denoted as W. In our case, let W = diag(1./sigma.^2), which is actually the inverse of the covariance matrix. And as you correctly noted, the book denoted R= diag(1./sigma.^2), which usually denotes the covariance matrix causing the confusion here. So I suggest changing the matrix R used in the code to W.
The example included is actually an extension to a previous example, which is example 3.9 with screenshot included below. I encoded the system in the |
Unless I'm mistaken, line 147 in
I'm afraid I don't follow. The
I'm sorry, but again I don't follow what you mean about "the way
Let's just stick with the original code, where
Just to confirm, you agree that the original code is correct in this regard? |
To summarize where I currently stand on the 5 primary changes proposed by this PR.
Since the proposed changes are pretty much independent of one another, my recommendation moving forward is to separate each into its own pull request consisting of changes to the original files (as opposed to additions of modified versions). For example, #3 could be accepted and merged in quickly. #1 and #2 will need more work, but they could be tracked and discussed independently. |
I think we branched in the discussion here. Going back to beginning, the original code is hard coded for a subset of the states and the proposed code extended it to the general case. Let us consider this case and then look at other extensions in the future.
Very well.
I'm afraid that I do not agree, if the code was correct, then it would produce the correct solution as in the book's Example 6.17. And it is not a bug in the data since the way the data is coded works perfectly with Example 3.9. |
I'm sorry. I'm not trying to be difficult. I just need to understand clearly what each change actually does. Let's focus on one point at a time. First, about item 3, you said ...
What I meant by point 3 was that, in the original code, each element of the Is there something that prevents this change from being done without making any changes to the set of measurements? |
I appreciate your time and effort in revising this PR. I agree, let us go through all the points. In response to your comment:
No, there nothing that prevents that. The original code used the same variance for all the PD (or any kind of measurements) whereas in the modified code each measurement (e.g. different PDs at different buses) can have a different variance. If I may take us to the next point, which is I would like to note that in the original code the demand real and reactive (PD & QD) where not included, whereas they are in the modified code. I believe it is a reasonable generalization. |
Ok, I think we agree on point 3. Would you be willing to create a new PR with just those changes? As I said, that's very straightforward and could be merged in quickly. On the next point you raise (point 1) about adding load measurements, let's take the discussion to #2. |
And let's take the discussion of point 5 to #3. |
It seems that there is a bug in computing the S matrix that affects the compulation of the derivative matrix H. As, such a new function has been developed to compute S. Moreover, the code is hardwired to solve the problem 6.7 in the book "Computational Methods for Electric Power Systems" by Mariesa Crow, 1st edition. In particular, it only accepts the measurements in that problem. So, the code is expanded to accommodate any sets of measurements. A test file "test_se_Ex_6_17.m" is provided that solves example 6.17 in the above 2nd edit of the book. The file shows the difference in computing H between the original, which is edited to allow more measurements, and the modified code. The modified code produced results that coincide with the solution of example 6.17 in the book.