diff --git a/src/main/java/gui/GuiController.java b/src/main/java/gui/GuiController.java index a402e23..901cf9f 100644 --- a/src/main/java/gui/GuiController.java +++ b/src/main/java/gui/GuiController.java @@ -35,9 +35,9 @@ public class GuiController extends AnchorPane { // ********** Fields **********// private ConicalTankProcess conicalTank; - private FirstOrderSystem process; - private PIController controller; - private PITuning piTuning; + private FirstOrderSystem process; + private PIController controller; + private PITuning piTuning; private Loop loop; @FXML private TextField heightSetPointTextField; @@ -108,7 +108,7 @@ private void registerListeners() { preferencesMenuItem.setOnAction(value -> showPreferences()); - // Loop refresh + // The loop inform about new values, so they are displayed in the gui: loop.timeStampProperty().addListener(updateGui); } diff --git a/src/main/java/process/ConicalTankProcess.java b/src/main/java/process/ConicalTankProcess.java index 637b4cc..6d05fae 100644 --- a/src/main/java/process/ConicalTankProcess.java +++ b/src/main/java/process/ConicalTankProcess.java @@ -53,15 +53,12 @@ protected void invalidated() { // ********** Methods **********// private void recalculate(){ + double k = (Math.pow(RADIUS, 2) * Math.PI ) / (Math.pow(HEIGHT, 2)); - double alpha = ((9/2) * - (OBSTRUCTION * Math.pow(HEIGHT,2) * Math.sqrt(2*GRAVITY) * Math.pow(heightOperationPoint.get(), -5/2)) / - (2 * Math.PI * Math.pow(RADIUS,2))) - - ((6 * Math.pow(HEIGHT,2) * inflowOperationPoint.get() * Math.pow(heightOperationPoint.get(),-3)) / - (Math.PI * Math.pow(RADIUS,2))); + double alpha = ((3 * OBSTRUCTION * Math.sqrt(2*GRAVITY) * Math.pow(getHeightOperationPoint(),-5/2)) / (2 * k)) - + ((2 * getInflowOperationPoint() * Math.pow(getHeightOperationPoint(), -3)) / (k)); - double beta = (3 * Math.pow(HEIGHT,2) * Math.pow(heightOperationPoint.get(),-2)) / - (Math.PI * Math.pow(RADIUS,2)); + double beta = Math.pow(getHeightOperationPoint(), -2) / k; transferFunction.setGain(beta / alpha); transferFunction.setTau(1 / alpha);