Skip to content

Redundant reports issued by multi-threaded Security Analysis #1167

Open
@Meklo

Description

@Meklo

Describe the current behavior

In AbstractSecurityAnalysis::runSync if the process is multi-threaded it results in redundant reports created through Reports::createDetailedSolverReporter, Reports::createNetworkInfoReporter and Reports::createPreContingencySimulation
because a network is loaded for each thread.
For example when running on 4 threads it gives the results pasted in Relevant Log Output section (data extracted from running OpenSecurityAnalysisTest::reportTest)

Describe the expected behavior

Reports generation shouldn't be affected by the configured number of threads. Ideally the result should match the content of https://github.com/powsybl/powsybl-open-loadflow/blob/main/src/test/resources/saReport.txt when running OpenSecurityAnalysisTest::reportTest on a multi-threaded process

Describe the steps

-Configure OpenSecurityAnalysisParameters's threadCount or set THREAD_COUNT_DEFAULT_VALUE to a value superior to one
-Run a Security Analysis
-Check the content of the resulting ReportNode

Environment

No response

Relevant Log Output

  • Test security analysis report
    • AC security analysis on network 'sim1'
      • Network CC0 SC0
        • Network info
          Network has 4 buses and 4 branches
          Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar
          Angle reference bus: VLHV1_0
          Slack bus: VLHV1_0
        • Pre-contingency simulation
          • Outer loop DistributedSlack
            • Outer loop iteration 1
              Slack bus active power (-1.4404045651219555 MW) distributed in 1 distribution iteration(s)
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              Outer loop DistributedSlack
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE)
        • Post-contingency simulation 'NHV1_NHV2_1'
          • Outer loop DistributedSlack
            • Outer loop iteration 1
              Slack bus active power (5.803741102800952 MW) distributed in 1 distribution iteration(s)
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              Outer loop DistributedSlack
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE)
      • Network CC0 SC0
        • Network info
          Network has 4 buses and 4 branches
          Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar
          Angle reference bus: VLHV1_0
          Slack bus: VLHV1_0
        • Pre-contingency simulation
          • Outer loop DistributedSlack
            • Outer loop iteration 1
              Slack bus active power (-1.4404045651219555 MW) distributed in 1 distribution iteration(s)
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              Outer loop DistributedSlack
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE)
        • Post-contingency simulation 'NHV1_NHV2_2'
          • Outer loop DistributedSlack
            • Outer loop iteration 1
              Slack bus active power (5.803741102800952 MW) distributed in 1 distribution iteration(s)
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              Outer loop DistributedSlack
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE)
      • Network CC0 SC0
        • Network info
          Network has 4 buses and 4 branches
          Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar
          Angle reference bus: VLHV1_0
          Slack bus: VLHV1_0
        • Pre-contingency simulation
          • Outer loop DistributedSlack
            • Outer loop iteration 1
              Slack bus active power (-1.4404045651219555 MW) distributed in 1 distribution iteration(s)
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              Outer loop DistributedSlack
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE)
        • Post-contingency simulation 'NGEN_NHV1'
          Network must have at least one bus with generator voltage control enabled
          AC load flow completed with error (solverStatus=SOLVER_FAILED, outerloopStatus=STABLE)
      • Network CC0 SC0
        • Network info
          Network has 4 buses and 4 branches
          Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar
          Angle reference bus: VLHV1_0
          Slack bus: VLHV1_0
        • Pre-contingency simulation
          • Outer loop DistributedSlack
            • Outer loop iteration 1
              Slack bus active power (-1.4404045651219555 MW) distributed in 1 distribution iteration(s)
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              Outer loop DistributedSlack
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE)
        • Post-contingency simulation 'NHV2_NLOAD'
          • Outer loop DistributedSlack
            • Outer loop iteration 1
              Slack bus active power (-5.4942194604343655 MW) distributed in 1 distribution iteration(s)
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              Outer loop DistributedSlack
              Outer loop VoltageMonitoring
              Outer loop ReactiveLimits
              AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE)

Extra Information

Here's a patch of a fix I did on my side, it consists in reconciling the report content afterward but I'm not sure if this is the right approach, feel free to reuse it if it may help
factorize_multi-threaded_security_analysis_imports.zip

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions