PowerFlowSettings.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. /**
  43. * Disables the automatic scaling for the power and voltage values.
  44. */
  45. public boolean disableAutomaticScaling;
  46. public PowerFlowSettings() {
  47. solverSettings = new SolverSettings(); // use default
  48. onlyUpdateGridWhenChanged = true;
  49. maxSolverThreads = 2;
  50. waitForSolverJob = false;
  51. skipGridsWithNoProducers = true;
  52. replaceNodeWithSlackNode = true;
  53. slackNodePlacementStrategy = SlackNodePlacementStrategy.MinimizeSlack;
  54. maxSlackPowerUntilInvalid = Double.MAX_VALUE;
  55. minVoltageUntilInvalid = 0.3;
  56. disableAutomaticScaling = false;
  57. }
  58. /**
  59. * Returns default settings.
  60. * @return The default settings.
  61. */
  62. public static PowerFlowSettings getDefault() {
  63. return new PowerFlowSettings();
  64. }
  65. }