Electa-Git / PowerModelsDistributionStateEstimation.jl

A Julia Package for Power System State Estimation.
BSD 3-Clause "New" or "Revised" License
32 stars 12 forks source link

Expression for the variable in a residual #5

Closed timmyfaraday closed 4 years ago

timmyfaraday commented 4 years ago

As the electrical 'variable' for a residual may be an expression, e.g., (vr^2+vi^2), we should think about creating a function that returns an expression depending on the underlying problem, similar for dst and var.

This will avoid the duplication of code, and may be a solution to the problem recognition stuff mentioned in #3

MartaVanin commented 4 years ago

In progress, this is a comment just to let you know the following before I forget. I think state-estimation-wise it is better not to check whether measurements exist for the new-variable-space components in the expressions for variable space conversion. An example: I want to work with ACPolar and include a current magnitude measurement :cm. To rewrite it in the polar variable space I have the following expression: :cm^2 = (:p^2+:q^2)/:vm^2 I was writing code that checks if :p or :q or :vm are measured, to replace them in the expression, making it less computationally complex. However, there is some contradiction in doing this. Take the extreme case where everything is measured: :cm = 2.14 , :p = 2.10, :q = 0.12 and :vm = 0.99 . This would lead to the expression 4.58 = 4.51, which can perfectly happen as every measurement has its own error so the equality is not necessarily true. State-estimation-wise you normally want to have as much measurement redundancy as possible, as this normally corresponds to better estimations and/or more robustness. So, even if I have already :p, :q and :vm, and their relative residual variable, it does make sense for me to include :cm separately as well. But then, the philosophy would be that :cm needs a separate residual definition and if I replace parts of its expression I basically screw this up, to the point that I could get extreme cases as 4.58 = 4.51. In conclusion, I think it is better to keep the full, unknown expression, even though it is computationally harder. This should push the users to choose the right formulation based on their measurements. Perhaps it is even interesting to explore the balance between adding more measurements and the computational time to process them if they are in unfavourable coordinates. And we can also always try and see what happens if we relax the quadratic expressions to cones.