package holeg; import holeg.power_flow.SolverSettings; public class PowerFlowSettings { /** * The solver settings to use. */ public SolverSettings solverSettings; /** * When true the solver is only used when the grid has changed to any last solved grid. */ public boolean onlyUpdateGridWhenChanged; /** * Maximum number of solver threads to use for each subgrid. */ public int maxSolverThreads; /** * When true the solving is done synchronous with the main update. This will lead to the main thread waiting. */ public boolean waitForSolverJob; /** * When true grids which have no producers are not solved. */ public boolean skipGridsWithNoProducers; /** * When true the solver changes one node to the slack node when no slack node is given by the grid design. */ public boolean replaceNodeWithSlackNode; /** * Sets the slack node placement strategy which is used to create and solve the grid. */ public SlackNodePlacementStrategy slackNodePlacementStrategy; /** * Sets the maximum power the slack node should consume or produce. When the power is exceeded the grid * is returned as an invalid grid. */ public double maxSlackPowerUntilInvalid; /** * Sets the minimum voltage any node can have. When the voltage is lower of any node the grid is returned * as an invalid grid. */ public double minVoltageUntilInvalid; public PowerFlowSettings() { solverSettings = new SolverSettings(); // use default onlyUpdateGridWhenChanged = true; maxSolverThreads = 2; waitForSolverJob = false; skipGridsWithNoProducers = true; replaceNodeWithSlackNode = true; slackNodePlacementStrategy = SlackNodePlacementStrategy.MinimizeSlack; maxSlackPowerUntilInvalid = Double.MAX_VALUE; minVoltageUntilInvalid = 0.3; } /** * Returns default settings. * @return The default settings. */ public static PowerFlowSettings getDefault() { return new PowerFlowSettings(); } }