Skip to content

Commit

Permalink
Fix MacOS ARM build (#725)
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
  • Loading branch information
geofjamg authored Mar 12, 2024
1 parent 2633ec1 commit f2cc2bc
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import com.powsybl.dataframe.impl.Series;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory;
import com.powsybl.openloadflow.OpenLoadFlowParameters;
import com.powsybl.python.network.Dataframes;
import com.powsybl.python.network.Networks;
import com.powsybl.security.SecurityAnalysisParameters;
import com.powsybl.security.SecurityAnalysisResult;
import com.powsybl.security.monitor.StateMonitor;
import com.powsybl.security.results.BranchResult;
import org.assertj.core.api.Assertions;
import org.assertj.core.data.Offset;
import org.junit.jupiter.api.Test;

import java.util.Collections;
Expand All @@ -34,7 +34,6 @@ class SecurityAnalysisTest {

@Test
void testStateMonitors() {
var params = new OpenLoadFlowParameters();
SecurityAnalysisContext analysisContext = new SecurityAnalysisContext();
analysisContext.addContingency("NHV1_NHV2_1", Collections.singletonList("NHV1_NHV2_1"));
analysisContext.addMonitor(new StateMonitor(new ContingencyContext("NHV1_NHV2_1", ContingencyContextType.SPECIFIC),
Expand All @@ -43,13 +42,24 @@ void testStateMonitors() {
Collections.singleton("NHV1_NHV2_2"), Collections.emptySet(), Collections.emptySet()));
Network network = Networks.createEurostagTutorialExample1();
SecurityAnalysisResult result = analysisContext.run(network, new SecurityAnalysisParameters(), "OpenLoadFlow", Reporter.NO_OP);
assertThat(result.getPreContingencyResult().getNetworkResult().getBranchResults()).containsExactly(new BranchResult("NHV1_NHV2_2",
302.44404914466014, 98.74027438014933, 456.7689759899916, -300.43389523337316,
-137.18849307164064, 488.99279636727357));
assertThat(result.getPreContingencyResult().getNetworkResult().getBranchResults()).hasSize(1);
BranchResult branchResult = result.getPreContingencyResult().getNetworkResult().getBranchResults().get(0);
var eps = Offset.offset(1e-12);
assertThat(branchResult.getP1()).isCloseTo(302.44404914466014, eps);
assertThat(branchResult.getQ1()).isCloseTo(98.74027438014933, eps);
assertThat(branchResult.getI1()).isCloseTo(456.7689759899916, eps);
assertThat(branchResult.getP2()).isCloseTo(-300.43389523337316, eps);
assertThat(branchResult.getQ2()).isCloseTo(-137.18849307164064, eps);
assertThat(branchResult.getI2()).isCloseTo(488.99279636727357, eps);
assertThat(result.getPostContingencyResults()).hasSize(1);
assertThat(result.getPostContingencyResults().get(0).getNetworkResult().getBranchResults()).containsExactly(new BranchResult("NHV1_NHV2_2",
610.5621535433198, 334.0562715296571, 1008.9287882269945, -600.9961559564284,
-285.3791465506596, 1047.8257691455574));
assertThat(result.getPreContingencyResult().getNetworkResult().getBranchResults()).hasSize(1);
branchResult = result.getPostContingencyResults().get(0).getNetworkResult().getBranchResults().get(0);
assertThat(branchResult.getP1()).isCloseTo(610.5621535433198, eps);
assertThat(branchResult.getQ1()).isCloseTo(334.0562715296571, eps);
assertThat(branchResult.getI1()).isCloseTo(1008.9287882269945, eps);
assertThat(branchResult.getP2()).isCloseTo(-600.9961559564284, eps);
assertThat(branchResult.getQ2()).isCloseTo(-285.3791465506596, eps);
assertThat(branchResult.getI2()).isCloseTo(1047.8257691455574, eps);
}

@Test
Expand Down

0 comments on commit f2cc2bc

Please sign in to comment.