|
@@ -32,6 +32,7 @@ public class controlAlgorithm implements AddOn {
|
|
|
private TextField waitBetweenIterations;
|
|
|
private TextField lowVolatageTextfield;
|
|
|
private TextField highVolatageTextfield;
|
|
|
+ private TextField renewableTextfield;
|
|
|
|
|
|
private int blackstartSuccessTime;
|
|
|
private int blackstartStartTime;
|
|
@@ -59,7 +60,7 @@ public class controlAlgorithm implements AddOn {
|
|
|
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, createOptionPanel(), scrollPane);
|
|
|
splitPane.setResizeWeight(0.0);
|
|
|
content.add(splitPane, BorderLayout.CENTER);
|
|
|
- content.setPreferredSize(new Dimension(800, 800));
|
|
|
+ content.setPreferredSize(new Dimension(1000, 800));
|
|
|
}
|
|
|
|
|
|
public JPanel createOptionPanel() {
|
|
@@ -131,22 +132,30 @@ public class controlAlgorithm implements AddOn {
|
|
|
waitBetweenIterationsLabel.setBounds(110, 205, 300, 20);
|
|
|
parameterPanel.add(waitBetweenIterationsLabel);
|
|
|
|
|
|
-// ////////collums
|
|
|
-// lowVolatageTextfield = new TextField("230");
|
|
|
-// lowVolatageTextfield.setBounds(425, 10, 95, 20);
|
|
|
-// parameterPanel.add(lowVolatageTextfield);
|
|
|
-//
|
|
|
-// JLabel lowVolatageLabel = new JLabel("low voltage in volt");
|
|
|
-// lowVolatageLabel.setBounds(530, 10, 300, 20);
|
|
|
-// parameterPanel.add(lowVolatageLabel);
|
|
|
-//
|
|
|
-// highVolatageTextfield = new TextField("20000");
|
|
|
-// highVolatageTextfield.setBounds(425, 35, 95, 20);
|
|
|
-// parameterPanel.add(highVolatageTextfield);
|
|
|
-//
|
|
|
-// JLabel highVolatageLabel = new JLabel("high voltage in volt");
|
|
|
-// highVolatageLabel.setBounds(530, 35, 300, 20);
|
|
|
-// parameterPanel.add(highVolatageLabel);
|
|
|
+ ////////collums
|
|
|
+ lowVolatageTextfield = new TextField("230");
|
|
|
+ lowVolatageTextfield.setBounds(425, 10, 95, 20);
|
|
|
+ parameterPanel.add(lowVolatageTextfield);
|
|
|
+
|
|
|
+ JLabel lowVolatageLabel = new JLabel("low voltage in volt");
|
|
|
+ lowVolatageLabel.setBounds(530, 10, 300, 20);
|
|
|
+ parameterPanel.add(lowVolatageLabel);
|
|
|
+
|
|
|
+ highVolatageTextfield = new TextField("20000");
|
|
|
+ highVolatageTextfield.setBounds(425, 35, 95, 20);
|
|
|
+ parameterPanel.add(highVolatageTextfield);
|
|
|
+
|
|
|
+ JLabel highVolatageLabel = new JLabel("high voltage in volt");
|
|
|
+ highVolatageLabel.setBounds(530, 35, 300, 20);
|
|
|
+ parameterPanel.add(highVolatageLabel);
|
|
|
+
|
|
|
+ renewableTextfield = new TextField("300");
|
|
|
+ renewableTextfield.setBounds(425, 60, 95, 20);
|
|
|
+ parameterPanel.add(renewableTextfield);
|
|
|
+
|
|
|
+ JLabel renewableLabel = new JLabel("renewable power per element in watt");
|
|
|
+ renewableLabel.setBounds(530, 60, 300, 20);
|
|
|
+ parameterPanel.add(renewableLabel);
|
|
|
|
|
|
return parameterPanel;
|
|
|
}
|
|
@@ -219,14 +228,19 @@ public class controlAlgorithm implements AddOn {
|
|
|
println("No Power Plant in Model");
|
|
|
return;
|
|
|
}
|
|
|
- resistanceCalculator resistanceCalculator = new resistanceCalculator(230, 20000, 30, 30,0.017, 0.017);//TODO
|
|
|
- resistanceCalculator.setDistancesToCalcResistance(powerplant);
|
|
|
+ control.getModel().setResistanceCalculator(new resistanceCalculator(
|
|
|
+ Integer.parseInt(lowVolatageTextfield.getText()),
|
|
|
+ Integer.parseInt(highVolatageTextfield.getText()),
|
|
|
+ 30, 30,0.017, 0.017));
|
|
|
+ control.getModel().getResistanceCalculator().setDistancesToCalcResistance(powerplant);
|
|
|
+
|
|
|
blackstartRunningCounter = 0;
|
|
|
deactivateBlackstart();
|
|
|
control.getModel().setCurIteration(0);
|
|
|
|
|
|
// prepare model
|
|
|
/////////
|
|
|
+ setRenewableElements(Float.parseFloat(renewableTextfield.getText()));
|
|
|
disablePowerplantProduction();
|
|
|
enableAllConsumers();
|
|
|
SPC.setAllStorageToStandy();
|
|
@@ -404,6 +418,21 @@ public class controlAlgorithm implements AddOn {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void setRenewableElements(float energy){
|
|
|
+ for (HolonObject house : renewableProducers) {
|
|
|
+ for (HolonElement ele : house.getElements()) {
|
|
|
+ if (ele.getEleName().equals("Solar Panels")) {// TODO: hier muss noch mehr dazu
|
|
|
+ ele.setEnergyPerElement(
|
|
|
+ control.getModel().getResistanceCalculator().calcEnergyAfterResistance(
|
|
|
+ energy,
|
|
|
+ ele.getLowDistance(),
|
|
|
+ ele.getHighDistance(),
|
|
|
+ getEnergyRequiredForPowerplantBlackstart()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private float currentRenewableProduction() {
|
|
|
float production = 0;
|
|
|
for (HolonObject house : renewableProducers) {
|