From 915e531b4efcdc4bfb794ffd89ab4859a6706d22 Mon Sep 17 00:00:00 2001 From: "d.emmel" Date: Mon, 10 Jul 2023 18:09:42 +0200 Subject: [PATCH] Redirection of console stream to consolePane; Added missing output values/controls; Added input parameter check; Added first tooltip (test) --- pom.xml | 7 + .../de/dominikemmel/reflowlab/MainApp.java | 76 + .../ActiveMaterialsController.java | 2 + .../CostAnalysisCalculation.java | 31 +- .../CostAnalysisToolController.java | 1016 ++++- .../ObjCostAnalysisOutput.java | 2 + .../electrolytes/ElectrolytesController.java | 2 + .../ConsoleOverviewController.java | 82 + .../maincontrol/MainController.java | 22 +- .../controller/maincontrol/ReaderThread.java | 117 + .../references/ReferencesController.java | 2 + .../solvent/SolventOrgController.java | 2 + src/main/java/module-info.java | 3 + .../fxml/costAnalysisTool.fxml | 3543 +++++++++++------ .../reflowlab/controller/home/fxml/home.fxml | 2 +- .../maincontrol/fxml/consoleOverview.fxml | 19 +- .../controller/maincontrol/fxml/main.fxml | 498 +-- 17 files changed, 3749 insertions(+), 1677 deletions(-) create mode 100644 src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/ConsoleOverviewController.java create mode 100644 src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/ReaderThread.java diff --git a/pom.xml b/pom.xml index d921c09..d15e5eb 100644 --- a/pom.xml +++ b/pom.xml @@ -130,6 +130,13 @@ 2.2 test + + + + org.scilab.forge + jlatexmath + 1.0.7 + diff --git a/src/main/java/de/dominikemmel/reflowlab/MainApp.java b/src/main/java/de/dominikemmel/reflowlab/MainApp.java index 84a5980..d72e73a 100644 --- a/src/main/java/de/dominikemmel/reflowlab/MainApp.java +++ b/src/main/java/de/dominikemmel/reflowlab/MainApp.java @@ -2,18 +2,35 @@ import java.awt.Color; import java.io.IOException; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.io.PrintStream; +import de.dominikemmel.reflowlab.controller.maincontrol.ConsoleOverviewController; +import de.dominikemmel.reflowlab.controller.maincontrol.ReaderThread; import javafx.application.Application; +import javafx.application.Platform; +import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.control.TextArea; import javafx.scene.image.Image; import javafx.stage.Stage; import javafx.stage.StageStyle; +import javafx.stage.WindowEvent; public class MainApp extends Application { + + private final PipedInputStream pipeIn = new PipedInputStream(); + private final PipedInputStream pipeIn2 = new PipedInputStream(); + Thread errorThrower; + private Thread reader; + private Thread reader2; + boolean quit; + private TextArea txtArea; @Override public void start(Stage primaryStage) throws IOException { @@ -36,12 +53,71 @@ public void start(Stage primaryStage) throws IOException { // Database.createConnection("electrolyte"); // Database.createConnection("costAnalysis"); // Database.createConnection("reference"); + + + txtArea = ConsoleOverviewController.staticTxtArea; + + //Thread execution for reading output stream + executeReaderThreads(); + + //Thread closing on stag close event + primaryStage.setOnCloseRequest(new EventHandler() { + @Override + public void handle(WindowEvent e) { + + closeThread(); + Platform.exit(); + System.exit(0); + } + }); } + + //method to handle thread closing on stage closing + synchronized void closeThread() { + System.out.println("Message: Stage is closed."); + this.quit = true; + notifyAll(); + try { this.reader.join(1000L); this.pipeIn.close(); } catch (Exception e) { + }try { this.reader2.join(1000L); this.pipeIn2.close(); } catch (Exception e) { + }System.exit(0); + } + + /** + * @param args the command line arguments + */ public static void main(String[] args) throws Exception { launch(args); } + + public void executeReaderThreads() { + try { + PipedOutputStream pout = new PipedOutputStream(this.pipeIn); + System.setOut(new PrintStream(pout, true)); + } + catch (IOException io) { + + } + catch (SecurityException se) { + + } + + try { + PipedOutputStream pout2 = new PipedOutputStream(this.pipeIn2); + System.setErr(new PrintStream(pout2, true)); + } + catch (IOException io) { + + } + catch (SecurityException se) { + + } + + ReaderThread obj = new ReaderThread(pipeIn, pipeIn2, errorThrower, reader, reader2, quit, txtArea); + + + } } diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ActiveMaterialsController.java b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ActiveMaterialsController.java index 3caef96..aca853d 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ActiveMaterialsController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ActiveMaterialsController.java @@ -87,6 +87,8 @@ public void reloadDataActiveMaterials() { try { tblActiveMaterial.refresh(); + + Database.createConnection("activeMaterial"); ResultSet res = Database.selectData("activeMaterial"); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/CostAnalysisCalculation.java b/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/CostAnalysisCalculation.java index e9e188b..b05ae38 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/CostAnalysisCalculation.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/CostAnalysisCalculation.java @@ -345,7 +345,7 @@ public ObjCostAnalysisOutput calculationPolarisation(ObjCostAnalysisInput input, // if (reversibleVoltage == 0) { if (!standardSelected) { - if (catholyteReversiblePotential == 0) { + if (catholyteReversiblePotential == 42) { // catholyteReversiblePotential = calculationElectrolytePotential("standardE_Input", catholyteStandardPotential, temp, z, catholyteActMatRedConc, catholyteActMatOxConc, catholyteActMatCoeff, protonConc, catholyteActMatNumberProton); catholyteReversiblePotential = catholyteStandardPotential - G*temp/(z*F)* @@ -355,7 +355,7 @@ public ObjCostAnalysisOutput calculationPolarisation(ObjCostAnalysisInput input, // Math.log(Math.pow(catholyteActMatRedConc,catholyteActMatCoeff)/(Math.pow(catholyteActMatOxConc,catholyteActMatCoeff)*Math.pow(1,catholyteActMatNumberProton))); } - if (anolyteReversiblePotential == 0) { + if (anolyteReversiblePotential == 42) { anolyteReversiblePotential= anolyteStandardPotential - G*temp/(z*F)* Math.log(Math.pow(anolyteActMatRedConc,anolyteActMatCoeff)/(Math.pow(anolyteActMatOxConc,anolyteActMatCoeff)*Math.pow(protonConc,anolyteActMatNumberProton))); @@ -376,7 +376,7 @@ public ObjCostAnalysisOutput calculationPolarisation(ObjCostAnalysisInput input, } else { //Anolyte = standard: if (anolyteStandard) { - if (anolyteReversiblePotential == 0) { + if (anolyteReversiblePotential == 42) { if (leftAqueous) { anolyteReversiblePotential = -0.6 - G*temp/(2*F)*Math.log(1/Math.pow(protonConc,2)); @@ -385,7 +385,7 @@ public ObjCostAnalysisOutput calculationPolarisation(ObjCostAnalysisInput input, //TODO: organic solvents } } - if (catholyteReversiblePotential == 0) { + if (catholyteReversiblePotential == 42) { catholyteReversiblePotential = catholyteStandardPotential - G*temp/(z*F)* Math.log(Math.pow(catholyteActMatRedConc,catholyteActMatCoeff)/(Math.pow(catholyteActMatOxConc,catholyteActMatCoeff)*Math.pow(protonConc,catholyteActMatNumberProton))); @@ -400,7 +400,7 @@ public ObjCostAnalysisOutput calculationPolarisation(ObjCostAnalysisInput input, //Catholyte = standard: if (catholyteStandard) { - if (catholyteReversiblePotential == 0) { + if (catholyteReversiblePotential == 42) { if (leftAqueous) { catholyteReversiblePotential = 1.6 - G*temp/(4*F)*Math.log(1/Math.pow(protonConc,4)); @@ -410,7 +410,7 @@ public ObjCostAnalysisOutput calculationPolarisation(ObjCostAnalysisInput input, } } - if (anolyteReversiblePotential == 0) { + if (anolyteReversiblePotential == 42) { anolyteReversiblePotential = anolyteStandardPotential - G*temp/(z*F)* Math.log(Math.pow(anolyteActMatRedConc,anolyteActMatCoeff)/(Math.pow(anolyteActMatOxConc,anolyteActMatCoeff)*Math.pow(protonConc,anolyteActMatNumberProton))); @@ -991,12 +991,12 @@ public ObjCostAnalysisOutput calculationElectrolyte(ObjCostAnalysisInput input, // electrolyte: double anolyteSaltConc = input.anolyteSaltConc.getValue(); - double anolyteSaltSol = input.anolyteSaltSol.getValue(); +// double anolyteSaltSol = input.anolyteSaltSol.getValue(); double anolyteSaltMolMass = input.anolyteSaltMolMass.getValue(); double anolyteSolventDensity = input.anolyteSolventDensity.getValue(); double anolyteActMatMolMass = input.anolyteActMatMolMass.getValue(); double catholyteSaltConc = input.catholyteSaltConc.getValue(); - double catholyteSaltSol = input.catholyteSaltSol.getValue(); +// double catholyteSaltSol = input.catholyteSaltSol.getValue(); double catholyteSaltMolMass = input.catholyteSaltMolMass.getValue(); double catholyteSolventDensity = input.catholyteSolventDensity.getValue(); double catholyteActMatMolMass = input.catholyteActMatMolMass.getValue(); @@ -1031,15 +1031,12 @@ public ObjCostAnalysisOutput calculationElectrolyte(ObjCostAnalysisInput input, // L / kg kg^-1: - if (anolyteSaltSol == 0) { - anolyteSaltSol = anolyteSaltConc * anolyteSaltMolMass / (anolyteSolventDensity*1000); - } + + double anolyteSaltSol = anolyteSaltConc * anolyteSaltMolMass / (anolyteSolventDensity*1000); double anolyteActMatSol = anolyteActMatConc * anolyteActMatMolMass / (anolyteSolventDensity*1000); - if (catholyteSaltSol == 0) { - catholyteSaltSol = catholyteSaltConc * catholyteSaltMolMass / (catholyteSolventDensity*1000); - } + double catholyteSaltSol = catholyteSaltConc * catholyteSaltMolMass / (catholyteSolventDensity*1000); double catholyteActMatSol = catholyteActMatConc * catholyteActMatMolMass / (catholyteSolventDensity*1000); @@ -1280,7 +1277,7 @@ public ObjCostAnalysisOutput calculationTotalCosts(ObjCostAnalysisInput input, O double anolyteEnergyDensityKg = anolyteEnergyDensity / (anolyteSolventDensity + (anolyteActMatMolMass * Math.pow(10, -3) * anolyteActMatConc)); double catholyteEnergyDensityKg = catholyteEnergyDensity / (catholyteSolventDensity + (catholyteActMatMolMass * Math.pow(10, -3) * catholyteActMatConc)); double energyDensityKg = 0; - //TODO: Export with EnergyDensity(Working electrode) + Frontend: Add anolyte and catholyte EnergyDensity + if (standardSelected) { //Anolyte = standard: if (anolyteStandard) { @@ -1322,8 +1319,8 @@ public ObjCostAnalysisOutput calculationTotalCosts(ObjCostAnalysisInput input, O output.anolyteEnergyDensity.set(anolyteEnergyDensity); output.catholyteEnergyDensity.set(catholyteEnergyDensity); output.energyDensity.set(energyDensity); -// output.anolyteEnergyDensityKg.set(anolyteEnergyDensityKg); -// output.catholyteEnergyDensityKg.set(catholyteEnergyDensityKg); + output.anolyteEnergyDensityKg.set(anolyteEnergyDensityKg); + output.catholyteEnergyDensityKg.set(catholyteEnergyDensityKg); output.energyDensityKg.set(energyDensityKg); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/CostAnalysisToolController.java b/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/CostAnalysisToolController.java index 9a3801d..8d66fd9 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/CostAnalysisToolController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/CostAnalysisToolController.java @@ -4,6 +4,8 @@ import java.awt.BasicStroke; import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -20,6 +22,7 @@ import java.util.ResourceBundle; import javax.swing.JFileChooser; +import javax.swing.JFrame; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; @@ -30,6 +33,9 @@ import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; +import org.scilab.forge.jlatexmath.TeXConstants; +import org.scilab.forge.jlatexmath.TeXFormula; +import org.scilab.forge.jlatexmath.TeXIcon; import org.jfree.chart.ui.*; import javafx.beans.property.DoubleProperty; @@ -38,6 +44,7 @@ import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.embed.swing.SwingFXUtils; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; @@ -46,12 +53,17 @@ import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; +import javafx.scene.control.ContentDisplay; import javafx.scene.control.Label; import javafx.scene.control.TextField; +import javafx.scene.control.Tooltip; import javafx.scene.image.Image; +import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.scene.text.Text; +import javafx.scene.web.WebEngine; +import javafx.scene.web.WebView; import javafx.stage.Stage; import de.dominikemmel.reflowlab.Database; import de.dominikemmel.reflowlab.FxmlLoader; @@ -183,6 +195,15 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { private Text anolyteActMatNumberProton1; @FXML private Text anolyteActMatNumberProton2; + + @FXML + private Text anolyteActMatConc1; + @FXML + private Text anolyteActMatConc2; + @FXML + private Text anolyteActMatConc3; + @FXML + private Text anolyteActMatConc4; @FXML private Text anolyteActMatSol1; @@ -201,6 +222,15 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { private Text anolyteSaltMolMass3; @FXML private Text anolyteSaltMolMass4; + + @FXML + private Text anolyteSaltConc1; + @FXML + private Text anolyteSaltConc2; + @FXML + private Text anolyteSaltConc3; + @FXML + private Text anolyteSaltConc4; @FXML private Text anolyteSaltSol1; @@ -257,6 +287,15 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { @FXML private Text catholyteActMatNumberProton2; + @FXML + private Text catholyteActMatConc1; + @FXML + private Text catholyteActMatConc2; + @FXML + private Text catholyteActMatConc3; + @FXML + private Text catholyteActMatConc4; + @FXML private Text catholyteActMatSol1; @FXML @@ -274,6 +313,15 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { private Text catholyteSaltMolMass3; @FXML private Text catholyteSaltMolMass4; + + @FXML + private Text catholyteSaltConc1; + @FXML + private Text catholyteSaltConc2; + @FXML + private Text catholyteSaltConc3; + @FXML + private Text catholyteSaltConc4; @FXML private Text catholyteSaltSol1; @@ -365,6 +413,38 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { @FXML private Text pH1; + + @FXML + private Text anolyteSolventDensity1; + @FXML + private Text anolyteSolventDensity2; + @FXML + private Text anolyteSolventDensity3; + @FXML + private Text anolyteSolventDensity4; + + @FXML + private Text catholyteSolventDensity1; + @FXML + private Text catholyteSolventDensity2; + @FXML + private Text catholyteSolventDensity3; + @FXML + private Text catholyteSolventDensity4; + + @FXML + private Text anolyteSolventViscosity1; + @FXML + private Text anolyteSolventViscosity2; + @FXML + private Text anolyteSolventViscosity3; + + @FXML + private Text catholyteSolventViscosity1; + @FXML + private Text catholyteSolventViscosity2; + @FXML + private Text catholyteSolventViscosity3; @FXML private Text anolyteTankCost1; @@ -604,6 +684,81 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { private Text catholyteConcentrationOverPotDischarge2; @FXML private Text catholyteConcentrationOverPotDischarge3; + + @FXML + private Text anolyteReynoldsNumber1; + @FXML + private Text anolyteReynoldsNumber2; + @FXML + private Text anolyteReynoldsNumber3; + + @FXML + private Text anolyteSchmidtNumber1; + @FXML + private Text anolyteSchmidtNumber2; + @FXML + private Text anolyteSchmidtNumber3; + + @FXML + private Text anolyteSherwoodNumber1; + @FXML + private Text anolyteSherwoodNumber2; + @FXML + private Text anolyteSherwoodNumber3; + + @FXML + private Text anolyteDiffLayerThickness1; + @FXML + private Text anolyteDiffLayerThickness2; + @FXML + private Text anolyteDiffLayerThickness3; + + @FXML + private Text ilimitAnolyte1; + @FXML + private Text ilimitAnolyte2; + @FXML + private Text ilimitAnolyte3; + @FXML + private Text ilimitAnolyte4; + + @FXML + private Text catholyteReynoldsNumber1; + @FXML + private Text catholyteReynoldsNumber2; + @FXML + private Text catholyteReynoldsNumber3; + + @FXML + private Text catholyteSchmidtNumber1; + @FXML + private Text catholyteSchmidtNumber2; + @FXML + private Text catholyteSchmidtNumber3; + + @FXML + private Text catholyteSherwoodNumber1; + @FXML + private Text catholyteSherwoodNumber2; + @FXML + private Text catholyteSherwoodNumber3; + + @FXML + private Text catholyteDiffLayerThickness1; + @FXML + private Text catholyteDiffLayerThickness2; + @FXML + private Text catholyteDiffLayerThickness3; + + @FXML + private Text ilimitCatholyte1; + @FXML + private Text ilimitCatholyte2; + @FXML + private Text ilimitCatholyte3; + @FXML + private Text ilimitCatholyte4; + @FXML private Text cellArea1; @@ -819,13 +974,45 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { private Text catholyteCostTotalKAh3; @FXML private Text catholyteCostTotalKAh4; + @FXML - private Text energyDensity1; + private Text anolyteEnergyDensity1; + @FXML + private Text anolyteEnergyDensity2; + @FXML + private Text anolyteEnergyDensity3; + @FXML + private Text anolyteEnergyDensity4; + + @FXML + private Text catholyteEnergyDensity1; @FXML - private Text energyDensity2; + private Text catholyteEnergyDensity2; @FXML - private Text energyDensity3; + private Text catholyteEnergyDensity3; + @FXML + private Text catholyteEnergyDensity4; + + @FXML + private Text anolyteEnergyDensityKg1; + @FXML + private Text anolyteEnergyDensityKg2; + @FXML + private Text anolyteEnergyDensityKg3; + @FXML + private Text anolyteEnergyDensityKg4; + + @FXML + private Text catholyteEnergyDensityKg1; + @FXML + private Text catholyteEnergyDensityKg2; + @FXML + private Text catholyteEnergyDensityKg3; + @FXML + private Text catholyteEnergyDensityKg4; + + @FXML private Text costElectrolyte1; @@ -979,10 +1166,14 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { @FXML private TextField txtfdAnolyteActMatNumberProton; @FXML + private TextField txtfdAnolyteActMatConc; + @FXML private TextField txtfdAnolyteActMatSol; @FXML private TextField txtfdAnolyteSaltMolMass; @FXML + private TextField txtfdAnolyteSaltConc; + @FXML private TextField txtfdAnolyteSaltSol; @FXML private TextField txtfdAnolytePotential; @@ -1000,10 +1191,14 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { @FXML private TextField txtfdCatholyteActMatNumberProton; @FXML + private TextField txtfdCatholyteActMatConc; + @FXML private TextField txtfdCatholyteActMatSol; @FXML private TextField txtfdCatholyteSaltMolMass; @FXML + private TextField txtfdCatholyteSaltConc; + @FXML private TextField txtfdCatholyteSaltSol; @FXML private TextField txtfdCatholytePotential; @@ -1026,11 +1221,17 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { @FXML private TextField txtfdSolventCost; @FXML - private TextField txtfdSolventDensity; - @FXML private TextField txtfdTemp; @FXML private TextField txtfdPH; + @FXML + private TextField txtfdAnolyteSolventDensity; + @FXML + private TextField txtfdCatholyteSolventDensity; + @FXML + private TextField txtfdAnolyteSolventViscosity; + @FXML + private TextField txtfdCatholyteSolventViscosity; @FXML private TextField txtfdAnolyteTankCost; @@ -1098,6 +1299,26 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { private TextField txtfbAnolyteConcentrationOverPotDischarge; @FXML private TextField txtfbCatholyteConcentrationOverPotDischarge; + @FXML + private TextField txtfbAnolyteReynoldsNumber; + @FXML + private TextField txtfbAnolyteSchmidtNumber; + @FXML + private TextField txtfbAnolyteSherwoodNumber; + @FXML + private TextField txtfbAnolyteDiffLayerThickness; + @FXML + private TextField txtfbIlimitAnolyte; + @FXML + private TextField txtfbCatholyteReynoldsNumber; + @FXML + private TextField txtfbCatholyteSchmidtNumber; + @FXML + private TextField txtfbCatholyteSherwoodNumber; + @FXML + private TextField txtfbCatholyteDiffLayerThickness; + @FXML + private TextField txtfbIlimitCatholyte; @FXML private TextField txtfdCellArea; @@ -1162,7 +1383,13 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { private TextField txtfdCatholyteCostTotalKAh; @FXML - private TextField txtfdEnergyDensity; + private TextField txtfdAnolyteEnergyDensity; + @FXML + private TextField txtfdCatholyteEnergyDensity; + @FXML + private TextField txtfdAnolyteEnergyDensityKg; + @FXML + private TextField txtfdCatholyteEnergyDensityKg; @FXML private TextField txtfdCostElectrolyte; @@ -1239,6 +1466,9 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { Boolean chargeTransferMode = true; Boolean transportationLimitationMode = true; Boolean materialSelected = false; + + int selectionModeLeft = 0; + int selectionModeRight = 0; //variables for ComboBox selection: String inputLeftActiveMaterial; @@ -1347,8 +1577,8 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { double temp = rT; double reversibleCellVoltageEl = 0; - double catholyteReversiblePotential = 0; - double anolyteReversiblePotential = 0; + double catholyteReversiblePotential = 42; + double anolyteReversiblePotential = 42; // double catholyteReversiblePotentialPh0 = 0; // double anolyteReversiblePotentialPh0 = 0; double diffActMatElmitanodeCatholyte = 0; @@ -1363,7 +1593,7 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { double saltCost = 0; double solventCost = 0; - double solventDensity = 0; +// double solventDensity = 0; double anolyteTankCost = 0; double catholyteTankCost = 0; @@ -1443,6 +1673,17 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { double catholyteConcentrationOverPotDischarge = 0; double anolyteConcentrationOverPotDischarge = 0; double concentrationOverPotDischarge = 0; + + double anolyteReynoldsNumber = 0; + double anolyteSchmidtNumber = 0; + double anolyteSherwoodNumber = 0; + double anolyteDiffLayerThickness = 0; + double ilimitAnolyte = 0; + double catholyteReynoldsNumber = 0; + double catholyteSchmidtNumber = 0; + double catholyteSherwoodNumber = 0; + double catholyteDiffLayerThickness = 0; + double ilimitCatholyte = 0; double cellArea = 0; double totalArea = 0; @@ -1482,6 +1723,8 @@ public class CostAnalysisToolController implements javafx.fxml.Initializable { double catholyteCostTotalKAh = 0; double energyDensity = 0; + double anolyteEnergyDensity = 0; + double catholyteEnergyDensity = 0; double anolyteEnergyDensityKg = 0; double catholyteEnergyDensityKg = 0; double energyDensityKg = 0; @@ -1636,6 +1879,22 @@ public void addLabels() { anolyteActMatNumberProton2.setTranslateY(anolyteActMatNumberProton1.getFont().getSize() * 0.3); + //anolyteActMatConc: + anolyteActMatConc1.setText("c"); + anolyteActMatConc1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + anolyteActMatConc2.setText("a"); + anolyteActMatConc2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteActMatConc2.setTranslateY(anolyteActMatConc1.getFont().getSize() * 0.3); + + anolyteActMatConc3.setText(" / mol L"); + anolyteActMatConc3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + anolyteActMatConc4.setText("-1"); + anolyteActMatConc4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteActMatConc4.setTranslateY(anolyteActMatConc1.getFont().getSize() * -0.3); + + //anolyteActMatSol: anolyteActMatSol1.setText("L"); anolyteActMatSol1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); @@ -1666,6 +1925,22 @@ public void addLabels() { anolyteSaltMolMass4.setText("-1"); anolyteSaltMolMass4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); anolyteSaltMolMass4.setTranslateY(anolyteSaltMolMass1.getFont().getSize() * -0.3); + + + //anolyteSaltConc: + anolyteSaltConc1.setText("c"); + anolyteSaltConc1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + anolyteSaltConc2.setText("salt, a"); + anolyteSaltConc2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteSaltConc2.setTranslateY(anolyteSaltConc1.getFont().getSize() * 0.3); + + anolyteSaltConc3.setText(" / mol L"); + anolyteSaltConc3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + anolyteSaltConc4.setText("-1"); + anolyteSaltConc4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteSaltConc4.setTranslateY(anolyteSaltConc1.getFont().getSize() * -0.3); //anolyteSaltSol: @@ -1751,7 +2026,7 @@ public void addLabels() { catholyteActMatNumberElectron1.setText("n"); catholyteActMatNumberElectron1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); - catholyteActMatNumberElectron2.setText("e, a"); + catholyteActMatNumberElectron2.setText("e, c"); catholyteActMatNumberElectron2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); catholyteActMatNumberElectron2.setTranslateY(catholyteActMatNumberElectron1.getFont().getSize() * 0.3); @@ -1765,6 +2040,22 @@ public void addLabels() { catholyteActMatNumberProton2.setTranslateY(catholyteActMatNumberProton1.getFont().getSize() * 0.3); + //catholyteActMatConc: + catholyteActMatConc1.setText("c"); + catholyteActMatConc1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + catholyteActMatConc2.setText("c"); + catholyteActMatConc2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteActMatConc2.setTranslateY(catholyteActMatConc1.getFont().getSize() * 0.3); + + catholyteActMatConc3.setText(" / mol L"); + catholyteActMatConc3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + catholyteActMatConc4.setText("-1"); + catholyteActMatConc4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteActMatConc4.setTranslateY(catholyteActMatConc1.getFont().getSize() * -0.3); + + //catholyteActMatSol: catholyteActMatSol1.setText("L"); catholyteActMatSol1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); @@ -1797,6 +2088,22 @@ public void addLabels() { catholyteSaltMolMass4.setTranslateY(catholyteSaltMolMass1.getFont().getSize() * -0.3); + //catholyteSaltConc: + catholyteSaltConc1.setText("c"); + catholyteSaltConc1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + catholyteSaltConc2.setText("salt, c"); + catholyteSaltConc2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteSaltConc2.setTranslateY(catholyteSaltConc1.getFont().getSize() * 0.3); + + catholyteSaltConc3.setText(" / mol L"); + catholyteSaltConc3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + catholyteSaltConc4.setText("-1"); + catholyteSaltConc4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteSaltConc4.setTranslateY(catholyteSaltConc1.getFont().getSize() * -0.3); + + //catholyteSaltSol: catholyteSaltSol1.setText("L"); catholyteSaltSol1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); @@ -1924,17 +2231,6 @@ public void addLabels() { solventCost4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); solventCost4.setTranslateY(solventCost1.getFont().getSize() * -0.3); - //solventDensity: - solventDensity1.setText("density"); - solventDensity1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); - - solventDensity2.setText(" / g cm"); - solventDensity2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); - - solventDensity3.setText("-3"); - solventDensity3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); - solventDensity3.setTranslateY(solventDensity1.getFont().getSize() * -0.3); - //temp: temp1.setText("T"); temp1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); @@ -1946,6 +2242,58 @@ public void addLabels() { pH1.setText("pH"); pH1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + //anolyteSolventDensity: + anolyteSolventDensity1.setText("density"); + anolyteSolventDensity1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + anolyteSolventDensity2.setText("a"); + anolyteSolventDensity2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteSolventDensity2.setTranslateY(anolyteSolventDensity1.getFont().getSize() * 0.3); + + anolyteSolventDensity3.setText(" / g cm"); + anolyteSolventDensity3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + anolyteSolventDensity4.setText("-3"); + anolyteSolventDensity4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteSolventDensity4.setTranslateY(anolyteSolventDensity1.getFont().getSize() * -0.3); + + //catholyteSolventDensity: + catholyteSolventDensity1.setText("density"); + catholyteSolventDensity1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + catholyteSolventDensity2.setText("c"); + catholyteSolventDensity2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteSolventDensity2.setTranslateY(catholyteSolventDensity1.getFont().getSize() * 0.3); + + catholyteSolventDensity3.setText(" / g cm"); + catholyteSolventDensity3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + catholyteSolventDensity4.setText("-3"); + catholyteSolventDensity4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteSolventDensity4.setTranslateY(catholyteSolventDensity1.getFont().getSize() * -0.3); + + //anolyteSolventViscosity: + anolyteSolventViscosity1.setText("dyn. viscosity"); + anolyteSolventViscosity1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + anolyteSolventViscosity2.setText("a"); + anolyteSolventViscosity2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteSolventViscosity2.setTranslateY(anolyteSolventViscosity1.getFont().getSize() * 0.3); + + anolyteSolventViscosity3.setText(" / Pa s"); + anolyteSolventViscosity3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + //catholyteSolventViscosity: + catholyteSolventViscosity1.setText("dyn. viscosity"); + catholyteSolventViscosity1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + catholyteSolventViscosity2.setText("c"); + catholyteSolventViscosity2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteSolventViscosity2.setTranslateY(catholyteSolventViscosity1.getFont().getSize() * 0.3); + + catholyteSolventViscosity3.setText(" / Pa s"); + catholyteSolventViscosity3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + //anolyteTankCost: @@ -2375,7 +2723,126 @@ public void addLabels() { catholyteConcentrationOverPotDischarge3.setText(" / V"); catholyteConcentrationOverPotDischarge3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + //anolyteReynoldsNumber: + anolyteReynoldsNumber1.setText("Re"); + anolyteReynoldsNumber1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + anolyteReynoldsNumber2.setText("a"); + anolyteReynoldsNumber2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteReynoldsNumber2.setTranslateY(anolyteReynoldsNumber1.getFont().getSize() * 0.3); + + anolyteReynoldsNumber3.setText(""); + anolyteReynoldsNumber3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + //anolyteSchmidtNumber: + anolyteSchmidtNumber1.setText("Sc"); + anolyteSchmidtNumber1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + anolyteSchmidtNumber2.setText("a, red"); + anolyteSchmidtNumber2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteSchmidtNumber2.setTranslateY(anolyteSchmidtNumber1.getFont().getSize() * 0.3); + + anolyteSchmidtNumber3.setText(""); + anolyteSchmidtNumber3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + //anolyteSherwoodNumber: + anolyteSherwoodNumber1.setText("Sh"); + anolyteSherwoodNumber1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + anolyteSherwoodNumber2.setText("a, red"); + anolyteSherwoodNumber2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteSherwoodNumber2.setTranslateY(anolyteSherwoodNumber1.getFont().getSize() * 0.3); + + anolyteSherwoodNumber3.setText(""); + anolyteSherwoodNumber3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + //anolyteDiffLayerThickness: + anolyteDiffLayerThickness1.setText("δ"); + anolyteDiffLayerThickness1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + anolyteDiffLayerThickness2.setText("a, red"); + anolyteDiffLayerThickness2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteDiffLayerThickness2.setTranslateY(anolyteDiffLayerThickness1.getFont().getSize() * 0.3); + + anolyteDiffLayerThickness3.setText(" / m"); + anolyteDiffLayerThickness3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + + //ilimitAnolyte: + ilimitAnolyte1.setText("i"); + ilimitAnolyte1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + ilimitAnolyte2.setText("limit | a, red"); + ilimitAnolyte2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + ilimitAnolyte2.setTranslateY(ilimitAnolyte1.getFont().getSize() * 0.3); + + ilimitAnolyte3.setText(" / A m"); + ilimitAnolyte3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + + ilimitAnolyte4.setText("-2"); + ilimitAnolyte4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + ilimitAnolyte4.setTranslateY(ilimitAnolyte1.getFont().getSize() * -0.3); + + + //catholyteReynoldsNumber: + catholyteReynoldsNumber1.setText("Re"); + catholyteReynoldsNumber1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + catholyteReynoldsNumber2.setText("c"); + catholyteReynoldsNumber2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteReynoldsNumber2.setTranslateY(catholyteReynoldsNumber1.getFont().getSize() * 0.3); + + catholyteReynoldsNumber3.setText(""); + catholyteReynoldsNumber3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + //catholyteSchmidtNumber: + catholyteSchmidtNumber1.setText("Sc"); + catholyteSchmidtNumber1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + catholyteSchmidtNumber2.setText("c, ox"); + catholyteSchmidtNumber2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteSchmidtNumber2.setTranslateY(catholyteSchmidtNumber1.getFont().getSize() * 0.3); + + catholyteSchmidtNumber3.setText(""); + catholyteSchmidtNumber3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + //catholyteSherwoodNumber: + catholyteSherwoodNumber1.setText("Sh"); + catholyteSherwoodNumber1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + catholyteSherwoodNumber2.setText("c, ox"); + catholyteSherwoodNumber2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteSherwoodNumber2.setTranslateY(catholyteSherwoodNumber1.getFont().getSize() * 0.3); + + catholyteSherwoodNumber3.setText(""); + catholyteSherwoodNumber3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + //catholyteDiffLayerThickness: + catholyteDiffLayerThickness1.setText("δ"); + catholyteDiffLayerThickness1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + catholyteDiffLayerThickness2.setText("c, ox"); + catholyteDiffLayerThickness2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteDiffLayerThickness2.setTranslateY(catholyteDiffLayerThickness1.getFont().getSize() * 0.3); + + catholyteDiffLayerThickness3.setText(" / m"); + catholyteDiffLayerThickness3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + + //ilimitCatholyte: + ilimitCatholyte1.setText("i"); + ilimitCatholyte1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-style: italic"); + + ilimitCatholyte2.setText("limit | c, ox"); + ilimitCatholyte2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + ilimitCatholyte2.setTranslateY(ilimitCatholyte1.getFont().getSize() * 0.3); + + ilimitCatholyte3.setText(" / A m"); + ilimitCatholyte3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + + ilimitCatholyte4.setText("-2"); + ilimitCatholyte4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + ilimitCatholyte4.setTranslateY(ilimitCatholyte1.getFont().getSize() * -0.3); + @@ -2741,18 +3208,71 @@ public void addLabels() { catholyteCostTotalKAh4.setTranslateY(catholyteCostTotalKAh1.getFont().getSize() * -0.3); + + + //anolyteEnergyDensity: + anolyteEnergyDensity1.setText("energy density"); + anolyteEnergyDensity1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + anolyteEnergyDensity2.setText("a"); + anolyteEnergyDensity2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteEnergyDensity2.setTranslateY(anolyteEnergyDensity1.getFont().getSize() * 0.3); + anolyteEnergyDensity3.setText(" / Wh L"); + anolyteEnergyDensity3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); - //energyDensity: - energyDensity1.setText("energy density"); - energyDensity1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + anolyteEnergyDensity4.setText("-1"); + anolyteEnergyDensity4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteEnergyDensity4.setTranslateY(anolyteEnergyDensity1.getFont().getSize() * -0.3); + + + //catholyteEnergyDensity: + catholyteEnergyDensity1.setText("energy density"); + catholyteEnergyDensity1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + catholyteEnergyDensity2.setText("c"); + catholyteEnergyDensity2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteEnergyDensity2.setTranslateY(catholyteEnergyDensity1.getFont().getSize() * 0.3); + + catholyteEnergyDensity3.setText(" / Wh L"); + catholyteEnergyDensity3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); - energyDensity2.setText(" / Wh L"); - energyDensity2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + catholyteEnergyDensity4.setText("-1"); + catholyteEnergyDensity4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteEnergyDensity4.setTranslateY(catholyteEnergyDensity1.getFont().getSize() * -0.3); + + + //anolyteEnergyDensityKg: + anolyteEnergyDensityKg1.setText("energy density"); + anolyteEnergyDensityKg1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + anolyteEnergyDensityKg2.setText("a"); + anolyteEnergyDensityKg2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteEnergyDensityKg2.setTranslateY(anolyteEnergyDensityKg1.getFont().getSize() * 0.3); - energyDensity3.setText("-1"); - energyDensity3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); - energyDensity3.setTranslateY(energyDensity1.getFont().getSize() * -0.3); + anolyteEnergyDensityKg3.setText(" / Wh kg"); + anolyteEnergyDensityKg3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + anolyteEnergyDensityKg4.setText("-1"); + anolyteEnergyDensityKg4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + anolyteEnergyDensityKg4.setTranslateY(anolyteEnergyDensityKg1.getFont().getSize() * -0.3); + + + //catholyteEnergyDensityKg: + catholyteEnergyDensityKg1.setText("energy density"); + catholyteEnergyDensityKg1.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + catholyteEnergyDensityKg2.setText("c"); + catholyteEnergyDensityKg2.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteEnergyDensityKg2.setTranslateY(catholyteEnergyDensityKg1.getFont().getSize() * 0.3); + + catholyteEnergyDensityKg3.setText(" / Wh kg"); + catholyteEnergyDensityKg3.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold"); + + catholyteEnergyDensityKg4.setText("-1"); + catholyteEnergyDensityKg4.setStyle("-fx-fill: "+colorTxtInput+"; -fx-font-weight: bold; -fx-font-size: 9"); + catholyteEnergyDensityKg4.setTranslateY(catholyteEnergyDensityKg1.getFont().getSize() * -0.3); + @@ -3298,7 +3818,6 @@ private void changeLabelTitle() { private void populateComboLeftActiveMaterial() { - CostAnalysisToolController.this.checkSelection(); comboLeftActiveMaterial.setEditable(true); try { ResultSet res = Database.selectData("activeMaterial"); @@ -3316,7 +3835,6 @@ private void populateComboLeftActiveMaterial() { private void populateComboRightActiveMaterial() { - CostAnalysisToolController.this.checkSelection(); comboRightActiveMaterial.setEditable(true); try { ResultSet res = Database.selectData("activeMaterial"); @@ -3335,12 +3853,20 @@ private void populateComboRightActiveMaterial() { @FXML public void populateComboLeftSolvent(ActionEvent event) { - CostAnalysisToolController.this.checkSelection(); + + selectionModeLeft = 0; + + comboLeftActiveMaterial.setStyle("-fx-background-color: White"); + try { CostAnalysisToolController.this.clearValues(); - comboLeftSolvent.getSelectionModel().clearSelection(); +// comboLeftSolvent.getSelectionModel().clearSelection(); +// comboLeftSalt.getSelectionModel().clearSelection(); + + comboLeftSolvent.getItems().clear(); + comboLeftSalt.getItems().clear(); ResultSet res = Database.selectData("activeMaterial"); @@ -3360,18 +3886,28 @@ public void populateComboLeftSolvent(ActionEvent event) { } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } + + selectionModeLeft = 1; } @FXML public void populateComboRightSolvent(ActionEvent event) { - CostAnalysisToolController.this.checkSelection(); + + selectionModeRight = 0; + + comboRightActiveMaterial.setStyle("-fx-background-color: White"); + try { CostAnalysisToolController.this.clearValues(); - comboRightSolvent.getSelectionModel().clearSelection(); +// comboRightSolvent.getSelectionModel().clearSelection(); +// comboRightSalt.getSelectionModel().clearSelection(); + comboRightSolvent.getItems().clear(); + comboRightSalt.getItems().clear(); + ResultSet res = Database.selectData("activeMaterial"); ObservableList dataSolvent = FXCollections.observableArrayList(); @@ -3390,64 +3926,82 @@ public void populateComboRightSolvent(ActionEvent event) { } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } + + selectionModeRight = 1; } @FXML public void populateComboLeftSalt (ActionEvent event) { - CostAnalysisToolController.this.checkSelection(); - - try { - comboLeftSalt.getSelectionModel().clearSelection(); + + comboLeftSolvent.setStyle("-fx-background-color: White"); + + if (selectionModeLeft == 1) { + try { + +// comboLeftSalt.getSelectionModel().clearSelection(); + comboLeftSalt.getItems().clear(); - ResultSet res = Database.selectData("activeMaterial"); + ResultSet res = Database.selectData("activeMaterial"); - ObservableList dataSalt = FXCollections.observableArrayList(); + ObservableList dataSalt = FXCollections.observableArrayList(); - String leftActiveMaterialSelection = comboLeftActiveMaterial.getSelectionModel().getSelectedItem().toString(); - String leftSolventSelection = comboLeftSolvent.getSelectionModel().getSelectedItem().toString(); + String leftActiveMaterialSelection = comboLeftActiveMaterial.getSelectionModel().getSelectedItem().toString(); + String leftSolventSelection = comboLeftSolvent.getSelectionModel().getSelectedItem().toString(); - while (res.next()) { - if (res.getString("ABBREVIATION") == leftActiveMaterialSelection && res.getString("Solvent") == leftSolventSelection) { - String dataSaltCombination = res.getString("Salt") +", "+ res.getString("Saltc").toString() +"M"; - dataSalt.add(dataSaltCombination); + while (res.next()) { + if (res.getString("ABBREVIATION") == leftActiveMaterialSelection && res.getString("Solvent") == leftSolventSelection) { + String dataSaltCombination = res.getString("Salt") +", "+ res.getString("Saltc").toString() +"M"; + dataSalt.add(dataSaltCombination); + } } - } - comboLeftSalt.setItems(dataSalt); + comboLeftSalt.setItems(dataSalt); - } catch (ClassNotFoundException | SQLException e) { - e.printStackTrace(); + } catch (ClassNotFoundException | SQLException e) { + e.printStackTrace(); + } + selectionModeLeft = 2; } + + } @FXML public void populateComboRightSalt (ActionEvent event) { - CostAnalysisToolController.this.checkSelection(); - - try { - comboRightSalt.getSelectionModel().clearSelection(); + + comboRightSolvent.setStyle("-fx-background-color: White"); + + if (selectionModeRight == 1) { + try { + +// comboRightSalt.getSelectionModel().clearSelection(); + comboRightSalt.getItems().clear(); - ResultSet res = Database.selectData("activeMaterial"); + ResultSet res = Database.selectData("activeMaterial"); - ObservableList dataSalt = FXCollections.observableArrayList(); + ObservableList dataSalt = FXCollections.observableArrayList(); - String rightActiveMaterialSelection = comboRightActiveMaterial.getSelectionModel().getSelectedItem().toString(); - String rightSolventSelection = comboRightSolvent.getSelectionModel().getSelectedItem().toString(); + String rightActiveMaterialSelection = comboRightActiveMaterial.getSelectionModel().getSelectedItem().toString(); + String rightSolventSelection = comboRightSolvent.getSelectionModel().getSelectedItem().toString(); - while (res.next()) { - if (res.getString("ABBREVIATION") == rightActiveMaterialSelection && res.getString("Solvent") == rightSolventSelection) { - String dataSaltCombination = res.getString("Salt") +", "+ res.getString("Saltc").toString() +"M"; - dataSalt.add(dataSaltCombination); + while (res.next()) { + if (res.getString("ABBREVIATION") == rightActiveMaterialSelection && res.getString("Solvent") == rightSolventSelection) { + String dataSaltCombination = res.getString("Salt") +", "+ res.getString("Saltc").toString() +"M"; + dataSalt.add(dataSaltCombination); + } } - } - comboRightSalt.setItems(dataSalt); + comboRightSalt.setItems(dataSalt); - } catch (ClassNotFoundException | SQLException e) { - e.printStackTrace(); + } catch (ClassNotFoundException | SQLException e) { + e.printStackTrace(); + } + + selectionModeRight = 2; } + } @@ -3469,7 +4023,10 @@ public void populateComboStack () { @FXML public void selectComboStack(ActionEvent event) { - if(!comboLeftActiveMaterial.getValue().equals("custom")) { + + comboStack.setStyle("-fx-background-color: White"); + + if(!comboLeftActiveMaterial.getValue().equals("custom") && selectionModeLeft == 2 && !comboStack.getValue().equals("custom") && !comboStack.getValue().equals("")) { CostAnalysisToolController.this.checkSelection(); CostAnalysisToolController.this.clearValues(); CostAnalysisToolController.this.clearStackValues(); @@ -3479,7 +4036,10 @@ public void selectComboStack(ActionEvent event) { } @FXML public void selectComboLeftSalt(ActionEvent event) { - if(!comboLeftActiveMaterial.getValue().equals("custom")) { + + comboLeftSalt.setStyle("-fx-background-color: White"); + + if(!comboLeftActiveMaterial.getValue().equals("custom") && selectionModeLeft == 2 && !comboStack.getValue().equals("custom") && !comboStack.getValue().equals("")) { CostAnalysisToolController.this.checkSelection(); CostAnalysisToolController.this.clearValues(); CostAnalysisToolController.this.loadSQL(); @@ -3487,13 +4047,54 @@ public void selectComboLeftSalt(ActionEvent event) { } @FXML public void selectComboRightSalt(ActionEvent event) { - if(!comboLeftActiveMaterial.getValue().equals("custom")) { + + comboRightSalt.setStyle("-fx-background-color: White"); + + if(!comboLeftActiveMaterial.getValue().equals("custom") && selectionModeRight == 2 && !comboStack.getValue().equals("custom") && !comboStack.getValue().equals("")) { CostAnalysisToolController.this.checkSelection(); CostAnalysisToolController.this.clearValues(); CostAnalysisToolController.this.loadSQL(); } } + + public void checkComboInput() { + + if (!comboLeftActiveMaterial.getValue().equals("custom")) { + + if (comboLeftActiveMaterial.getValue().equals("")) { + comboLeftActiveMaterial.setStyle("-fx-background-color: Red"); + } + if (comboLeftSolvent.getValue().equals("")) { + comboLeftSolvent.setStyle("-fx-background-color: Red"); + } + if (comboLeftSalt.getValue().equals("")) { + comboLeftSalt.setStyle("-fx-background-color: Red"); + } + if (comboStack.getValue().equals("")) { + comboStack.setStyle("-fx-background-color: Red"); + } + + + if (!standardSelected) { + + if (comboRightActiveMaterial.getValue().equals("")) { + comboRightActiveMaterial.setStyle("-fx-background-color: Red"); + } + if (comboRightSolvent.getValue().equals("")) { + comboRightSolvent.setStyle("-fx-background-color: Red"); + } + if (comboRightSalt.getValue().equals("")) { + comboRightSalt.setStyle("-fx-background-color: Red"); + } + + } + } + + + + } + private void populateComboExportSelection() { comboExportSelection.setEditable(true); @@ -3529,7 +4130,7 @@ private void checkSelection() { } -// TODO: cell potential, c solv / mol L^-1, Fixed textFields on pane for results, Potential value for each active material +// TODO: cell potential, Potential value for each active material public void reloadValues () { txtfbTimeDischarge.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { @@ -3607,6 +4208,13 @@ public void reloadValues () { CostAnalysisToolController.this.uncheckCombo(); } }); + txtfdAnolyteActMatConc .textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + anolyteActMatConc = Double.valueOf(newValue); + anolyteActMatSol = 0; + CostAnalysisToolController.this.uncheckCombo(); + } + }); txtfdAnolyteActMatSol.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { anolyteActMatSol = Double.valueOf(newValue); @@ -3619,6 +4227,13 @@ public void reloadValues () { CostAnalysisToolController.this.uncheckCombo(); } }); + txtfdAnolyteSaltConc.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + anolyteSaltConc = Double.valueOf(newValue); + anolyteSaltSol = 0; + CostAnalysisToolController.this.uncheckCombo(); + } + }); txtfdAnolyteSaltSol.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { anolyteSaltSol = Double.valueOf(newValue); @@ -3668,6 +4283,13 @@ public void reloadValues () { CostAnalysisToolController.this.uncheckCombo(); } }); + txtfdCatholyteActMatConc.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + catholyteActMatConc = Double.valueOf(newValue); + catholyteActMatSol = 0; + CostAnalysisToolController.this.uncheckCombo(); + } + }); txtfdCatholyteActMatSol.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { catholyteActMatSol = Double.valueOf(newValue); @@ -3680,6 +4302,13 @@ public void reloadValues () { CostAnalysisToolController.this.uncheckCombo(); } }); + txtfdCatholyteSaltConc.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + catholyteSaltConc = Double.valueOf(newValue); + catholyteSaltSol = 0; + CostAnalysisToolController.this.uncheckCombo(); + } + }); txtfdCatholyteSaltSol.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { catholyteSaltSol = Double.valueOf(newValue); @@ -3744,12 +4373,6 @@ public void reloadValues () { CostAnalysisToolController.this.uncheckCombo(); } }); - txtfdSolventDensity.textProperty().addListener((observable, oldValue, newValue) -> { - if (!calculationCombo) { - solventDensity = Double.valueOf(newValue); - CostAnalysisToolController.this.uncheckCombo(); - } - }); txtfdTemp.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { temp = Double.valueOf(newValue); @@ -3765,6 +4388,30 @@ public void reloadValues () { CostAnalysisToolController.this.uncheckCombo(); } }); + txtfdAnolyteSolventDensity.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + anolyteSolventDensity = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfdCatholyteSolventDensity.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + catholyteSolventDensity = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfdAnolyteSolventViscosity.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + anolyteSolventViscosity = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfdCatholyteSolventViscosity.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + catholyteSolventViscosity = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); txtfdAnolyteTankCost.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { @@ -3926,7 +4573,6 @@ public void reloadValues () { CostAnalysisToolController.this.uncheckCombo(); } }); -// TODO: Add solvent density & viscosity (for catholyte and anolyte side) for custom mode --> currently those parameters are set by the previously selected system txtfbCatholyteDiffusionCoeff.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { catholyteDiffusionCoeff = Double.valueOf(newValue); @@ -3945,6 +4591,67 @@ public void reloadValues () { CostAnalysisToolController.this.uncheckCombo(); } }); + txtfbAnolyteReynoldsNumber.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + anolyteReynoldsNumber = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbAnolyteSchmidtNumber.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + anolyteSchmidtNumber = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbAnolyteSherwoodNumber.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + anolyteSherwoodNumber = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbAnolyteDiffLayerThickness.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + anolyteDiffLayerThickness = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbIlimitAnolyte.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + ilimitAnolyte = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbCatholyteReynoldsNumber.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + catholyteReynoldsNumber = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbCatholyteSchmidtNumber.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + catholyteSchmidtNumber = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbCatholyteSherwoodNumber.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + catholyteSherwoodNumber = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbCatholyteDiffLayerThickness.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + catholyteDiffLayerThickness = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfbIlimitCatholyte.textProperty().addListener((observable, oldValue, newValue) -> { + if (!calculationCombo) { + ilimitCatholyte = Double.valueOf(newValue); + CostAnalysisToolController.this.uncheckCombo(); + } + }); + txtfdCellArea.textProperty().addListener((observable, oldValue, newValue) -> { if (!calculationCombo) { cellArea = Double.valueOf(newValue); @@ -4089,6 +4796,11 @@ public void uncheckCombo () { comboLeftActiveMaterial.setValue("custom"); comboRightActiveMaterial.setValue("custom"); comboStack.setValue("custom"); + + comboLeftSolvent.setValue(""); + comboRightSolvent.setValue(""); + comboLeftSalt.setValue(""); + comboRightSalt.setValue(""); inputLeftActiveMaterial = "custom"; inputRightActiveMaterial = "custom"; @@ -4182,6 +4894,7 @@ public void clearValues () { anolyteSaltCost = 0; anolyteSolventCost = 0; anolyteSolventDensity = 0; + anolyteSolventViscosity = 0; catholyteActMatCost = 0; catholyteActMatCoeff = 0; @@ -4198,6 +4911,7 @@ public void clearValues () { catholyteSaltCost = 0; catholyteSolventCost = 0; catholyteSolventDensity = 0; + catholyteSolventViscosity = 0; SA_SocRange = 0; @@ -4210,8 +4924,8 @@ public void clearValues () { temp = rT; reversibleCellVoltageEl = 0; - catholyteReversiblePotential = 0; - anolyteReversiblePotential = 0; + catholyteReversiblePotential = 42; + anolyteReversiblePotential = 42; // catholyteReversiblePotentialPh0 = 0; // anolyteReversiblePotentialPh0 = 0; ravg = 0; @@ -4224,7 +4938,8 @@ public void clearValues () { saltCost = 0; solventCost = 0; - solventDensity = 0; + anolyteSolventDensity = 0; + catholyteSolventDensity = 0; anolyteTankCost = 0; catholyteTankCost = 0; @@ -4310,6 +5025,17 @@ public void clearValues () { catholyteConcentrationOverPotDischarge = 0; anolyteConcentrationOverPotDischarge = 0; concentrationOverPotDischarge = 0; + + anolyteReynoldsNumber = 0; + anolyteSchmidtNumber = 0; + anolyteSherwoodNumber = 0; + anolyteDiffLayerThickness = 0; + ilimitAnolyte = 0; + catholyteReynoldsNumber = 0; + catholyteSchmidtNumber = 0; + catholyteSherwoodNumber = 0; + catholyteDiffLayerThickness = 0; + ilimitCatholyte = 0; cellArea = 0; totalArea = 0; @@ -4349,6 +5075,8 @@ public void clearValues () { catholyteCostTotalKAh = 0; energyDensity = 0; + anolyteEnergyDensity = 0; + catholyteEnergyDensity = 0; anolyteEnergyDensityKg = 0; catholyteEnergyDensityKg = 0; energyDensityKg = 0; @@ -4403,7 +5131,84 @@ public void clearStackValues () { } } + + + + private void addTooltips() { + + String latex = "\\begin{array}{l}"; + latex += "\\forall\\varepsilon\\in\\mathbb{R}_+^*\\ \\exists\\eta>0\\ |x-x_0|\\leq\\eta\\Longrightarrow|f(x)-f(x_0)|\\leq\\varepsilon\\\\"; + latex += "\\det\\begin{bmatrix}a_{11}&a_{12}&\\cdots&a_{1n}\\\\a_{21}&\\ddots&&\\vdots\\\\\\vdots&&\\ddots&\\vdots\\\\a_{n1}&\\cdots&\\cdots&a_{nn}\\end{bmatrix}\\overset{\\mathrm{def}}{=}\\sum_{\\sigma\\in\\mathfrak{S}_n}\\varepsilon(\\sigma)\\prod_{k=1}^n a_{k\\sigma(k)}\\\\"; + latex += "\\sideset{_\\alpha^\\beta}{_\\gamma^\\delta}{\\begin{pmatrix}a&b\\\\c&d\\end{pmatrix}}\\\\"; + latex += "\\int_0^\\infty{x^{2n} e^{-a x^2}\\,dx} = \\frac{2n-1}{2a} \\int_0^\\infty{x^{2(n-1)} e^{-a x^2}\\,dx} = \\frac{(2n-1)!!}{2^{n+1}} \\sqrt{\\frac{\\pi}{a^{2n+1}}}\\\\"; + latex += "\\int_a^b{f(x)\\,dx} = (b - a) \\sum\\limits_{n = 1}^\\infty {\\sum\\limits_{m = 1}^{2^n - 1} {\\left( { - 1} \\right)^{m + 1} } } 2^{ - n} f(a + m\\left( {b - a} \\right)2^{-n} )\\\\"; + latex += "\\int_{-\\pi}^{\\pi} \\sin(\\alpha x) \\sin^n(\\beta x) dx = \\textstyle{\\left \\{ \\begin{array}{cc} (-1)^{(n+1)/2} (-1)^m \\frac{2 \\pi}{2^n} \\binom{n}{m} & n \\mbox{ odd},\\ \\alpha = \\beta (2m-n) \\\\ 0 & \\mbox{otherwise} \\\\ \\end{array} \\right .}\\\\"; + latex += "L = \\int_a^b \\sqrt{ \\left|\\sum_{i,j=1}^ng_{ij}(\\gamma(t))\\left(\\frac{d}{dt}x^i\\circ\\gamma(t)\\right)\\left(\\frac{d}{dt}x^j\\circ\\gamma(t)\\right)\\right|}\\,dt\\\\"; + latex += "\\begin{array}{rl} s &= \\int_a^b\\left\\|\\frac{d}{dt}\\vec{r}\\,(u(t),v(t))\\right\\|\\,dt \\\\ &= \\int_a^b \\sqrt{u'(t)^2\\,\\vec{r}_u\\cdot\\vec{r}_u + 2u'(t)v'(t)\\, \\vec{r}_u\\cdot\\vec{r}_v+ v'(t)^2\\,\\vec{r}_v\\cdot\\vec{r}_v}\\,\\,\\, dt. \\end{array}\\\\"; + latex += "\\end{array}"; + + TeXFormula tex = new TeXFormula(latex); + + java.awt.Image awtImage = tex.createBufferedImage(TeXConstants.STYLE_TEXT, 14, java.awt.Color.WHITE, null); + Image fxImage = SwingFXUtils.toFXImage((BufferedImage) awtImage, null); + ImageView view = new ImageView(fxImage); + + + Tooltip tooltip = new Tooltip(); +// tooltip.setPrefSize(200, 100); + tooltip.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); + + tooltip.setGraphic(view); + + Tooltip.install(txtfdAnolyteCostTotal, tooltip); + + + +// txtfdAnolyteActMatSol + String latexAnolyteActMatSol = "\\begin{array}{l}"; + latexAnolyteActMatSol += "{L = c }\\ \\cdot \\ \\frac{M}{\\varrho}\\ "; + latexAnolyteActMatSol += "{= " + String.valueOf(anolyteSaltConc) +"} {\\ mol\\ L}^{-1}\\ \\cdot \\ \\frac{" + String.valueOf(anolyteSaltMolMass) + "\\ g\\ mol^{-1}}{"+ String.valueOf(anolyteSolventDensity*1000) +"\\ g\\ L^{-1}}\\\\" ; + latexAnolyteActMatSol += "\\end{array}"; + + ImageView viewAnolyteActMatSol = getTooltipImage(latexAnolyteActMatSol); + Tooltip tooltipAnolyteActMatSol = new Tooltip(); + + tooltipAnolyteActMatSol.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); + + tooltipAnolyteActMatSol.setGraphic(viewAnolyteActMatSol); + + Tooltip.install(txtfdAnolyteActMatSol, tooltipAnolyteActMatSol); + + +// txtfdCatholyteActMatSol + String latexCatholyteActMatSol = "\\begin{array}{l}"; + latexCatholyteActMatSol += "{L = c }\\ \\cdot \\ \\frac{M}{\\varrho}\\ "; + latexCatholyteActMatSol += "{= " + String.valueOf(catholyteSaltConc) +"} {\\ mol\\ L}^{-1}\\ \\cdot \\ \\frac{" + String.valueOf(catholyteSaltMolMass) + "\\ g\\ mol^{-1}}{"+ String.valueOf(catholyteSolventDensity*1000) +"\\ g\\ L^{-1}}\\\\" ; + latexCatholyteActMatSol += "\\end{array}"; + + ImageView viewCatholyteActMatSol = getTooltipImage(latexCatholyteActMatSol); + Tooltip tooltipCatholyteActMatSol = new Tooltip(); + + tooltipCatholyteActMatSol.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); + + tooltipCatholyteActMatSol.setGraphic(viewCatholyteActMatSol); + + Tooltip.install(txtfdCatholyteActMatSol, tooltipCatholyteActMatSol); + + } + + private ImageView getTooltipImage(String latex) { + + TeXFormula tex = new TeXFormula(latex); + + java.awt.Image awtImage = tex.createBufferedImage(TeXConstants.STYLE_TEXT, 18, java.awt.Color.WHITE, null); + Image fxImage = SwingFXUtils.toFXImage((BufferedImage) awtImage, null); + ImageView view = new ImageView(fxImage); + + + return view; + } @@ -6029,6 +6834,17 @@ public void calculation() { catholyteChargeTranserOverPotDischarge = result.catholyteChargeTranserOverPotDischarge.getValue(); anolyteConcentrationOverPotDischarge = result.anolyteConcentrationOverPotDischarge.getValue(); catholyteConcentrationOverPotDischarge = result.catholyteConcentrationOverPotDischarge.getValue(); + + anolyteReynoldsNumber = result.anolyteReynoldsNumber.getValue(); + anolyteSchmidtNumber = result.anolyteSchmidtNumber.getValue(); + anolyteSherwoodNumber = result.anolyteSherwoodNumber.getValue(); + anolyteDiffLayerThickness = result.anolyteDiffLayerThickness.getValue(); + ilimitAnolyte = result.currentLimitAnolyte.getValue(); + catholyteReynoldsNumber = result.catholyteReynoldsNumber.getValue(); + catholyteSchmidtNumber = result.catholyteSchmidtNumber.getValue(); + catholyteSherwoodNumber = result.catholyteSherwoodNumber.getValue(); + catholyteDiffLayerThickness = result.catholyteDiffLayerThickness.getValue(); + ilimitCatholyte = result.currentLimitCatholyte.getValue(); efficiencyVoltDischarge = result.efficiencyVoltDischarge.getValue(); peakPowerRatio = result.peakPowerRatio.getValue(); @@ -6070,11 +6886,11 @@ public void calculation() { costMaintenance = result.costMaintenance.getValue(); costCapital = result.costCapital.getValue(); - double anolyteEnergyDensity = result.anolyteEnergyDensity.getValue(); - double catholyteEnergyDensity = result.catholyteEnergyDensity.getValue(); + anolyteEnergyDensity = result.anolyteEnergyDensity.getValue(); + catholyteEnergyDensity = result.catholyteEnergyDensity.getValue(); energyDensity = result.energyDensity.getValue(); -// anolyteEnergyDensityKg = result.anolyteEnergyDensityKg.getValue(); -// catholyteEnergyDensityKg = result.catholyteEnergyDensityKg.getValue(); + anolyteEnergyDensityKg = result.anolyteEnergyDensityKg.getValue(); + catholyteEnergyDensityKg = result.catholyteEnergyDensityKg.getValue(); energyDensityKg = result.energyDensityKg.getValue(); double cActiveAnolyte = result.cActiveAnolyte.getValue(); @@ -6110,8 +6926,10 @@ public void output() { txtfdAnolyteSocRange.setText(String.valueOf(anolyteSocRange)); txtfdAnolyteActMatNumberElectron.setText(String.valueOf(anolyteActMatNumberElectron)); txtfdAnolyteActMatNumberProton.setText(String.valueOf(anolyteActMatNumberProton)); + txtfdAnolyteActMatConc.setText(String.valueOf(anolyteActMatConc)); txtfdAnolyteActMatSol.setText(String.valueOf(anolyteActMatSol)); txtfdAnolyteSaltMolMass.setText(String.valueOf(anolyteSaltMolMass)); + txtfdAnolyteSaltConc.setText(String.valueOf(anolyteSaltConc)); txtfdAnolyteSaltSol.setText(String.valueOf(anolyteSaltSol)); txtfdAnolytePotential.setText(String.valueOf(anolyteReversiblePotential)); @@ -6122,8 +6940,10 @@ public void output() { txtfdCatholyteActMatNumberElectron.setText(String.valueOf(catholyteActMatNumberElectron)); txtfdCatholyteActMatNumberProton.setText(String.valueOf(catholyteActMatNumberProton)); txtfdCatholyteActMatNumberElectron.setText(String.valueOf(catholyteActMatNumberElectron)); + txtfdCatholyteActMatConc.setText(String.valueOf(catholyteActMatConc)); txtfdCatholyteActMatSol.setText(String.valueOf(catholyteActMatSol)); txtfdCatholyteSaltMolMass.setText(String.valueOf(catholyteSaltMolMass)); + txtfdCatholyteSaltConc.setText(String.valueOf(catholyteSaltConc)); txtfdCatholyteSaltSol.setText(String.valueOf(catholyteSaltSol)); txtfdCatholytePotential.setText(String.valueOf(catholyteReversiblePotential)); @@ -6137,7 +6957,10 @@ public void output() { txtfdSaltCost.setText(String.valueOf(anolyteSaltCost)); txtfdSolventCost.setText(String.valueOf(anolyteSolventCost)); - txtfdSolventDensity.setText(String.valueOf(anolyteSolventDensity)); + txtfdAnolyteSolventDensity.setText(String.valueOf(anolyteSolventDensity)); + txtfdCatholyteSolventDensity.setText(String.valueOf(catholyteSolventDensity)); + txtfdAnolyteSolventViscosity.setText(String.valueOf(anolyteSolventViscosity)); + txtfdCatholyteSolventViscosity.setText(String.valueOf(catholyteSolventViscosity)); txtfdTemp.setText(String.valueOf(temp)); txtfdPH.setText(String.valueOf(pHElectrolyte)); @@ -6175,6 +6998,16 @@ public void output() { txtfbCatholyteChargeTranserOverPotDischarge.setText(String.valueOf(catholyteChargeTranserOverPotDischarge)); txtfbAnolyteConcentrationOverPotDischarge.setText(String.valueOf(anolyteConcentrationOverPotDischarge)); txtfbCatholyteConcentrationOverPotDischarge.setText(String.valueOf(catholyteConcentrationOverPotDischarge)); + txtfbAnolyteReynoldsNumber.setText(String.valueOf(anolyteReynoldsNumber)); + txtfbAnolyteSchmidtNumber.setText(String.valueOf(anolyteSchmidtNumber)); + txtfbAnolyteSherwoodNumber.setText(String.valueOf(anolyteSherwoodNumber)); + txtfbAnolyteDiffLayerThickness.setText(String.valueOf(anolyteDiffLayerThickness)); + txtfbIlimitAnolyte.setText(String.valueOf(ilimitAnolyte)); + txtfbCatholyteReynoldsNumber.setText(String.valueOf(catholyteReynoldsNumber)); + txtfbCatholyteSchmidtNumber.setText(String.valueOf(catholyteSchmidtNumber)); + txtfbCatholyteSherwoodNumber.setText(String.valueOf(catholyteSherwoodNumber)); + txtfbCatholyteDiffLayerThickness.setText(String.valueOf(catholyteDiffLayerThickness)); + txtfbIlimitCatholyte.setText(String.valueOf(ilimitCatholyte)); txtfbDiaFiber.setText(String.valueOf(dFiber)); txtfbFlowVelocity.setText(String.valueOf(flowVelocity)); @@ -6220,8 +7053,11 @@ public void output() { txtfdCatholyteCostTotal.setText(String.valueOf(catholyteCostTotal)); txtfdCatholyteCostTotalKAh.setText(String.valueOf(catholyteCostTotalKAh)); - - txtfdEnergyDensity.setText(String.valueOf(energyDensity)); + + txtfdAnolyteEnergyDensity.setText(String.valueOf(anolyteEnergyDensity)); + txtfdCatholyteEnergyDensity.setText(String.valueOf(catholyteEnergyDensity)); + txtfdAnolyteEnergyDensityKg.setText(String.valueOf(anolyteEnergyDensityKg)); + txtfdCatholyteEnergyDensityKg.setText(String.valueOf(catholyteEnergyDensityKg)); txtfdCostElectrolyte.setText(String.valueOf(costElectrolyte)); txtfdCostElectrolyteKWh.setText(String.valueOf(costElectrolyteKWh)); @@ -6483,6 +7319,9 @@ public void output() { CostAnalysisToolController.this.drawNewChartLineChartPdId(newScatterChart3, PdIdDataset); calculationCombo = false; + + + CostAnalysisToolController.this.addTooltips(); } @@ -7058,6 +7897,7 @@ public void exportTableToTxt(ArrayList output) { @FXML public void btnCalculate(ActionEvent event) { + CostAnalysisToolController.this.checkComboInput(); CostAnalysisToolController.this.calculation(); CostAnalysisToolController.this.output(); } diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/ObjCostAnalysisOutput.java b/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/ObjCostAnalysisOutput.java index 9a331c3..6cffc85 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/ObjCostAnalysisOutput.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/costanalysistool/ObjCostAnalysisOutput.java @@ -171,6 +171,8 @@ public class ObjCostAnalysisOutput { public DoubleProperty anolyteEnergyDensity = new SimpleDoubleProperty(); public DoubleProperty catholyteEnergyDensity = new SimpleDoubleProperty(); + public DoubleProperty anolyteEnergyDensityKg = new SimpleDoubleProperty(); + public DoubleProperty catholyteEnergyDensityKg = new SimpleDoubleProperty(); public DoubleProperty energyDensity = new SimpleDoubleProperty(); public DoubleProperty energyDensityKg = new SimpleDoubleProperty(); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ElectrolytesController.java b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ElectrolytesController.java index 081daca..e6889eb 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ElectrolytesController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ElectrolytesController.java @@ -91,6 +91,8 @@ public void reloadDataElectrolytes() { try { tblElectrolytes.refresh(); + + Database.createConnection("electrolyte"); ResultSet res = Database.selectData("electrolyte"); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/ConsoleOverviewController.java b/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/ConsoleOverviewController.java new file mode 100644 index 0000000..83f1df0 --- /dev/null +++ b/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/ConsoleOverviewController.java @@ -0,0 +1,82 @@ +package de.dominikemmel.reflowlab.controller.maincontrol; + +import java.net.URL; +import java.util.ResourceBundle; + +import de.dominikemmel.reflowlab.controller.costanalysistool.CostAnalysisToolController; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.Button; +import javafx.scene.control.TextArea; +import javafx.scene.control.TitledPane; +import javafx.scene.image.ImageView; +import javafx.scene.layout.AnchorPane; +import javafx.stage.Stage; + +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.IOException; + +import javafx.application.Platform; +import javafx.event.ActionEvent; + +public class ConsoleOverviewController implements Initializable { + + @FXML + private PrintStream ps ; + + @FXML + private TextArea textAreaUI; + + @FXML + private Button btnClose; + + @FXML + private AnchorPane consoleAnchorPane; + + public static TextArea staticTxtArea; + + @Override + public void initialize(URL location, ResourceBundle resources) { + // TODO Auto-generated method stub + +// ps = new PrintStream(new Console(console)) ; + + staticTxtArea = textAreaUI; + + } +// +// public class Console extends OutputStream { +// private TextArea console; +// +// public Console(TextArea console) { +// this.console = console; +// } +// +// public void appendText(String valueOf) { +// Platform.runLater(() -> console.appendText(valueOf)); +// } +// +// public void write(int b) throws IOException { +// appendText(String.valueOf((char)b)); +// } +// } + + + + @FXML + public void btnCloseConsoleEvent(ActionEvent event) { + + ConsoleOverviewController.this.closeEvent(); + + } + + + public void closeEvent() { + Stage consoleStage = (Stage) consoleAnchorPane.getScene().getWindow(); + consoleStage.hide(); + } + + + +} diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/MainController.java b/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/MainController.java index c045b12..708740e 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/MainController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/MainController.java @@ -27,10 +27,12 @@ import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; +import javafx.scene.image.Image; import javafx.scene.input.MouseEvent; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; import javafx.stage.Stage; +import javafx.stage.StageStyle; import de.dominikemmel.reflowlab.Database; import de.dominikemmel.reflowlab.FxmlLoader; import de.dominikemmel.reflowlab.VariousMethods; @@ -57,6 +59,8 @@ public class MainController implements Initializable { private Button btnReference; @FXML private Button btnDB; + + Stage stageConsole = new Stage(); @Override @@ -84,6 +88,7 @@ public void initialize(URL arg0, ResourceBundle arg1) { MainController.defaultInitSettings(); MainController.this.dbTest(); MainController.this.testBtnDB(); + MainController.this.startConsole(); } @@ -529,16 +534,25 @@ public void selectPathPaneBtn() { @FXML public void openConsole(MouseEvent event) { + + stageConsole.show(); + + } + + public void startConsole() { try { Parent rootRagoneTool; rootRagoneTool = FXMLLoader.load(getClass().getResource("/de/dominikemmel/reflowlab/controller/maincontrol/fxml/consoleOverview.fxml")); - Stage stage = new Stage(); - stage.setScene(new Scene(rootRagoneTool)); - stage.show(); + + stageConsole.setScene(new Scene(rootRagoneTool)); + stageConsole.initStyle(StageStyle.DECORATED); +// stage.show(); + stageConsole.setTitle("Console"); + stageConsole.getIcons().add(new Image(getClass().getResourceAsStream("/de/dominikemmel/reflowlab/img/logo_simple/1x/logo_simple1x.png"))); + } catch (IOException e) { e.printStackTrace(); } - } } diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/ReaderThread.java b/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/ReaderThread.java new file mode 100644 index 0000000..31a3dd9 --- /dev/null +++ b/src/main/java/de/dominikemmel/reflowlab/controller/maincontrol/ReaderThread.java @@ -0,0 +1,117 @@ +package de.dominikemmel.reflowlab.controller.maincontrol; + + +import java.io.IOException; +import java.io.PipedInputStream; +import javafx.scene.control.TextArea; + +public class ReaderThread implements Runnable{ + + private final PipedInputStream pipeIn ; + private final PipedInputStream pipeIn2 ; + Thread errorThrower; + private Thread reader; + private Thread reader2; + private boolean quit; + + private TextArea txtArea; + + public ReaderThread(PipedInputStream pinInput1, PipedInputStream pinInput2, Thread errorThrower1, Thread reader11, Thread reader22, boolean newflag, TextArea txtArea1) + { + pipeIn = pinInput1; + pipeIn2 = pinInput2; + errorThrower = errorThrower1; + reader = reader11; + reader2 = reader22; + quit = newflag; + txtArea = txtArea1; + + this.quit = false; + this.reader = new Thread(this); + this.reader.setDaemon(true); + this.reader.start(); + + this.reader2 = new Thread(this); + this.reader2.setDaemon(true); + this.reader2.start(); + + this.errorThrower = new Thread(this); + this.errorThrower.setDaemon(true); + this.errorThrower.start(); + } + + + public synchronized void run() + { + try + { + while (Thread.currentThread() == this.reader) { + + try { + wait(100L); + } + catch (InterruptedException ie) + { + System.out.println("I am in thread 1"); + } + + if (this.pipeIn.available() != 0) + { + String input = readLine(this.pipeIn); //reading console output stream from pipedinputstream + this.txtArea.appendText(input); + } + if (this.quit) return; + } + + //while loop starting + while (Thread.currentThread() == this.reader2) { + try { + wait(100L); + } + catch (InterruptedException ie) + { + } + + if (this.pipeIn2.available() != 0) + { + String input = readLine(this.pipeIn2); + this.txtArea.appendText(input); + } + + if (this.quit) return; //if some one closed the stage then this check will be performed every time, if true + //thread execution will be stopped. + + } //while loop ending here + + } + catch (Exception e) + { + } + + if (Thread.currentThread() == this.errorThrower) { + try { + wait(800L); + } + catch (InterruptedException ie) { + } + System.out.println("********************************************************Console Started Successfully********************************************************"); + + } + } + + public synchronized String readLine(PipedInputStream in) + throws IOException + { + String input = ""; + do + { + int available = in.available(); + if (available == 0) break; + byte[] b = new byte[available]; + in.read(b); + input = input + new String(b, 0, b.length); + }while ((!input.endsWith("\n")) && (!input.endsWith("\r\n")) && (!this.quit)); + return input; + } + +} diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/references/ReferencesController.java b/src/main/java/de/dominikemmel/reflowlab/controller/references/ReferencesController.java index 6e09e6a..002b109 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/references/ReferencesController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/references/ReferencesController.java @@ -68,6 +68,8 @@ public void reloadDataReferences() { try { tblReference.refresh(); + + Database.createConnection("reference"); ResultSet res = Database.selectData("reference"); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/solvent/SolventOrgController.java b/src/main/java/de/dominikemmel/reflowlab/controller/solvent/SolventOrgController.java index 41ad76a..44d6cf4 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/solvent/SolventOrgController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/solvent/SolventOrgController.java @@ -194,6 +194,8 @@ public void reloadDataSolventOrg() { try { tblOrgSolvent.refresh(); + + Database.createConnection("solventOrganic"); ResultSet res = Database.selectData("solventOrganic"); diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 8ec4b53..3833731 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -20,6 +20,9 @@ requires org.jfree.fxgraphics2d; requires org.jfree.jfreechart; requires javafx.media; + requires jlatexmath; + requires javafx.web; + requires javafx.swing; // requires org.testfx.framework.junit5; diff --git a/src/main/resources/de/dominikemmel/reflowlab/controller/costanalysistool/fxml/costAnalysisTool.fxml b/src/main/resources/de/dominikemmel/reflowlab/controller/costanalysistool/fxml/costAnalysisTool.fxml index 4027718..9018a7e 100644 --- a/src/main/resources/de/dominikemmel/reflowlab/controller/costanalysistool/fxml/costAnalysisTool.fxml +++ b/src/main/resources/de/dominikemmel/reflowlab/controller/costanalysistool/fxml/costAnalysisTool.fxml @@ -1,1380 +1,2293 @@ + + + + - - - + + + - + - - - - - - -