|
@@ -13,12 +13,15 @@ public class PowerFlowAnalysisMenu extends JMenu {
|
|
private JMenuItem showFlow;
|
|
private JMenuItem showFlow;
|
|
private JMenuItem clearCache;
|
|
private JMenuItem clearCache;
|
|
private JMenuItem solve;
|
|
private JMenuItem solve;
|
|
|
|
+ private JMenuItem clearCacheAndSolve;
|
|
private JCheckBoxMenuItem disableUpdates;
|
|
private JCheckBoxMenuItem disableUpdates;
|
|
private JCheckBoxMenuItem showResultMessageBox;
|
|
private JCheckBoxMenuItem showResultMessageBox;
|
|
private JCheckBoxMenuItem showDebugMessageBox;
|
|
private JCheckBoxMenuItem showDebugMessageBox;
|
|
|
|
|
|
private static PowerFlowAnalysisMenu instance;
|
|
private static PowerFlowAnalysisMenu instance;
|
|
|
|
|
|
|
|
+ private boolean overwriteDisableUpdatesToForceUpdates = false;
|
|
|
|
+
|
|
public PowerFlowAnalysisMenu(Model model) {
|
|
public PowerFlowAnalysisMenu(Model model) {
|
|
super("Power flow");
|
|
super("Power flow");
|
|
|
|
|
|
@@ -27,8 +30,9 @@ public class PowerFlowAnalysisMenu extends JMenu {
|
|
addSeparator();
|
|
addSeparator();
|
|
clearCache = add(new JMenuItem("Clear cache"));
|
|
clearCache = add(new JMenuItem("Clear cache"));
|
|
solve = add(new JMenuItem("Solve"));
|
|
solve = add(new JMenuItem("Solve"));
|
|
|
|
+ clearCacheAndSolve = add(new JMenuItem("Clear cache and solve"));
|
|
addSeparator();
|
|
addSeparator();
|
|
- disableUpdates = (JCheckBoxMenuItem) add(new JCheckBoxMenuItem("Disable updates"));
|
|
|
|
|
|
+ disableUpdates = (JCheckBoxMenuItem) add(new JCheckBoxMenuItem("Disable automatic updates"));
|
|
showResultMessageBox = (JCheckBoxMenuItem) add(new JCheckBoxMenuItem("Show result message"));
|
|
showResultMessageBox = (JCheckBoxMenuItem) add(new JCheckBoxMenuItem("Show result message"));
|
|
showDebugMessageBox = (JCheckBoxMenuItem) add(new JCheckBoxMenuItem("Show debug message"));
|
|
showDebugMessageBox = (JCheckBoxMenuItem) add(new JCheckBoxMenuItem("Show debug message"));
|
|
|
|
|
|
@@ -36,11 +40,27 @@ public class PowerFlowAnalysisMenu extends JMenu {
|
|
SingletonControl.getInstance().getControl().getSimManager().getHolegPowerFlowContext().clearCache();
|
|
SingletonControl.getInstance().getControl().getSimManager().getHolegPowerFlowContext().clearCache();
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ solve.addActionListener((e) -> {
|
|
|
|
+ solve(false);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ clearCacheAndSolve.addActionListener((e) -> {
|
|
|
|
+ solve(true);
|
|
|
|
+ });
|
|
|
|
+
|
|
instance = this;
|
|
instance = this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void solve(boolean clearCache) {
|
|
|
|
+ overwriteDisableUpdatesToForceUpdates = true;
|
|
|
|
+ if (clearCache)
|
|
|
|
+ SingletonControl.getInstance().getControl().getSimManager().getHolegPowerFlowContext().clearCache();
|
|
|
|
+ SingletonControl.getInstance().getControl().calculateStateAndVisualForCurrentTimeStep();
|
|
|
|
+ overwriteDisableUpdatesToForceUpdates = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
public boolean areUpdatesDisabled() {
|
|
public boolean areUpdatesDisabled() {
|
|
- return disableUpdates.getState();
|
|
|
|
|
|
+ return !overwriteDisableUpdatesToForceUpdates && disableUpdates.getState();
|
|
}
|
|
}
|
|
|
|
|
|
public boolean shouldShowResult() {
|
|
public boolean shouldShowResult() {
|