-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add sensitivities on intensity #231
Conversation
|
||
if (i2 != null) { | ||
Equation i = equationSystem.createEquation(bus2.getNum(), EquationType.BUS_I).addTerm(i2); | ||
i.setActive(false); // equation is set to inactive so it does not appear in jacobian |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is certainly not the proper way to do this
assertEquals(5, result.getSensitivityValues().size()); | ||
// todo: Remove the *100 from assert. Currently the | ||
// todo: loadflow from OLF and Hades provides different results | ||
assertEquals(766.4654d, getFunctionReference(result, "l23"), LoadFlowAssert.DELTA_I * 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those *100 are needed because of a difference I have between Hades loadflow and Openloadflow loadflow. But maybe this is juste my hades2 config that is wrong ?
@@ -23,6 +23,7 @@ | |||
public static final double DELTA_ANGLE = 1E-6d; | |||
public static final double DELTA_V = 1E-3d; | |||
public static final double DELTA_POWER = 1E-3d; | |||
public static final double DELTA_I = 1E-2d; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10e-3 would be better, but as I said before, I have some trouble mapping the Hades2 loadflow with the OpenLoadFlow loadflow to check my results, even on a very small network (4 buses, 1 transfo)
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
a54456a
to
fd4b83f
Compare
double p1 = r1 * v1 * (g1 * r1 * v1 + y * r1 * v1 * sinKsi - y * R2 * v2 * sinTheta); | ||
double q1 = r1 * v1 * (-b1 * r1 * v1 + y * r1 * v1 * cosKsi - y * R2 * v2 * cosTheta); | ||
|
||
i1 = Math.hypot(p1, q1) / (Math.sqrt(3.) * v1 / 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hadrien-Godard @Djazouli I think we don't have to compute the intensity from p and q. I have done that before as it was a post-processing. Can we compute the intensity through the Ohm law ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can, but we will end up with the same formula since Ohm law is used to obtain above expression of p and q from v and phi.
The difficulty here is that Ohm law expresses a difference of complex tensions in term of a complex intensity, or the intensity that is measured (here i1) is in fact the magnitude ofthe complex intensity. Therefore the Math.hypot is needed to express this magnitude.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but it would be simpler to calculate re(i) and img(i) and then mod(i) that calculating p and q and then dividing by voltage for nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure it would be more efficient.
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
@@ -19,6 +19,8 @@ | |||
*/ | |||
abstract class AbstractBranchAcFlowEquationTerm extends AbstractNamedEquationTerm { | |||
|
|||
public static final double NORMALIZATION_FACTOR = 1000d / Math.sqrt(3d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could add a reference to CURRENT
in the name.
} | ||
} | ||
|
||
private List<SensitivityValue> getPostContingencySensitivityValues(List<LfSensitivityFactor<ClosedBranchSide1ActiveFlowEquationTerm>> lfFactors, | ||
protected void setReferenceActivePowerFlows(List<LfSensitivityFactor<? extends AbstractClosedBranchAcFlowEquationTerm>> factors) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to change the method name, and go back to one of your first choices setReferenceFunctions
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small changes but okay!
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
It seems that we have performance issues with that PR. Can we add a parameter to compute intensity only for sensitivity analysis involving factors that need too ? For load flow computation, we will have to compute intensity only after a NR convergence. |
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
/** | ||
* @author Gael Macherel <gael.macherel at artelys.com> | ||
*/ | ||
public class AllBranchesManager implements CurrentBranchesManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe AllCurrentBranchesManager
?
/** | ||
* @author Gael Macherel <gael.macherel at artelys.com> | ||
*/ | ||
public class SpecificBranchesManager implements CurrentBranchesManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe SpecificCurrentBranchesManager
?
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
@@ -17,14 +20,21 @@ | |||
|
|||
private final boolean forceA1Var; | |||
|
|||
private final BranchesCurrentManager branchesCurrentManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BranchesCurrentManager
is probably too much for just a branch list filtering, why not just a list of branch id and empty (or null) means all branches?
@@ -66,7 +66,8 @@ private void reIndex() { | |||
|
|||
Set<Variable> variablesToFind = new HashSet<>(); | |||
for (Equation equation : equations.values()) { | |||
if (equation.isActive()) { | |||
if (equation.isActive() && EquationUpdateType.DEFAULT.equals(equation.getUpdateType())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is safe to compare enum with == in Java
for (Equation equation : equations.values()) { | ||
equation.update(x); | ||
if (updateType.equals(equation.getUpdateType())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Kudos, SonarCloud Quality Gate passed! |
Signed-off-by: Gael Macherel gael.macherel@artelys.com
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)