PowerFlowSettings.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package holeg;
  2. import holeg.power_flow.SolverSettings;
  3. public class PowerFlowSettings {
  4. /**
  5. * The solver settings to use.
  6. */
  7. public SolverSettings solverSettings;
  8. /**
  9. * When true the solver is only used when the grid has changed to any last solved grid.
  10. */
  11. public boolean onlyUpdateGridWhenChanged;
  12. /**
  13. * Maximum number of solver threads to use for each subgrid.
  14. */
  15. public int maxSolverThreads;
  16. /**
  17. * When true the solving is done synchronous with the main update. This will lead to the main thread waiting.
  18. */
  19. public boolean waitForSolverJob;
  20. /**
  21. * When true grids which have no producers are not solved.
  22. */
  23. public boolean skipGridsWithNoProducers;
  24. /**
  25. * When true the solver changes one node to the slack node when no slack node is given by the grid design.
  26. */
  27. public boolean replaceNodeWithSlackNode;
  28. /**
  29. * Sets the slack node placement strategy which is used to create and solve the grid.
  30. */
  31. public SlackNodePlacementStrategy slackNodePlacementStrategy;
  32. /**
  33. * Sets the maximum power the slack node should consume or produce. When the power is exceeded the grid
  34. * is returned as an invalid grid.
  35. */
  36. public double maxSlackPowerUntilInvalid;
  37. /**
  38. * Sets the minimum voltage any node can have. When the voltage is lower of any node the grid is returned
  39. * as an invalid grid.
  40. */
  41. public double minVoltageUntilInvalid;
  42. public PowerFlowSettings() {
  43. solverSettings = new SolverSettings(); // use default
  44. onlyUpdateGridWhenChanged = true;
  45. maxSolverThreads = 2;
  46. waitForSolverJob = false;
  47. skipGridsWithNoProducers = true;
  48. replaceNodeWithSlackNode = true;
  49. slackNodePlacementStrategy = SlackNodePlacementStrategy.MinimizeSlack;
  50. maxSlackPowerUntilInvalid = Double.MAX_VALUE;
  51. minVoltageUntilInvalid = 0.3;
  52. }
  53. /**
  54. * Returns default settings.
  55. * @return The default settings.
  56. */
  57. public static PowerFlowSettings getDefault() {
  58. return new PowerFlowSettings();
  59. }
  60. }