From c9b45e01452177c2de5f99ff8cc94b45408c6db5 Mon Sep 17 00:00:00 2001 From: "d.emmel" Date: Sat, 12 Aug 2023 14:40:22 +0200 Subject: [PATCH] 1. Added active material categories 2. Added theoretical capacity (incl. a small calculation tool in the "Add" and "Edit" panes) of the cells in literature of which the fade rates are taken from. --> this should give a better overview at which scale the parameters are determined (especially if compared to upscaled systems in future) --- .../de/dominikemmel/reflowlab/Database.java | 6 + .../de/dominikemmel/reflowlab/MainApp.java | 2 + .../de/dominikemmel/reflowlab/Updates.java | 14 + .../ActiveMaterialsController.java | 12 +- .../AddActiveMaterialController.java | 7 +- .../EditActiveMaterialController.java | 8 +- .../activematerials/ObjActiveMaterial.java | 7 +- .../AddElectrolytesController.java | 82 +++- .../EditElectrolytesController.java | 90 +++- .../electrolytes/ElectrolytesController.java | 89 +++- .../electrolytes/ObjElectrolytes.java | 29 +- .../activematerials/fxml/activeMaterials.fxml | 356 ++++++++------- .../fxml/addActiveMaterial.fxml | 5 +- .../fxml/editActiveMaterial.fxml | 5 +- .../controller/costs/fxml/costs.fxml | 16 +- .../electrolytes/fxml/addElectrolytes.fxml | 282 +++++++----- .../electrolytes/fxml/editElectrolytes.fxml | 287 +++++++----- .../electrolytes/fxml/electrolytes.fxml | 416 ++++++++++-------- .../controller/maincontrol/fxml/main.fxml | 7 +- .../references/fxml/references.fxml | 24 +- .../controller/solvent/fxml/solvent.fxml | 4 +- .../controller/solvent/fxml/solventInorg.fxml | 166 +++---- .../controller/solvent/fxml/solventOrg.fxml | 222 +++++----- .../default/reflowlabDefaultDB.mv.db | Bin 245760 -> 389120 bytes 24 files changed, 1336 insertions(+), 800 deletions(-) create mode 100644 src/main/java/de/dominikemmel/reflowlab/Updates.java diff --git a/src/main/java/de/dominikemmel/reflowlab/Database.java b/src/main/java/de/dominikemmel/reflowlab/Database.java index 412e5e4..69cb62e 100644 --- a/src/main/java/de/dominikemmel/reflowlab/Database.java +++ b/src/main/java/de/dominikemmel/reflowlab/Database.java @@ -201,6 +201,7 @@ private static void initialise(String table) throws SQLException { + "Abbreviation VARCHAR(255)," + "Name VARCHAR(255)," + "StructuralFormula VARCHAR(255)," + + "Category VARCHAR(255)," + "M FLOAT," + "n INT," + "RefIDn INT," @@ -273,6 +274,11 @@ private static void initialise(String table) throws SQLException { + "degRate FLOAT," + "RefIDdegRate INT," + "f FLOAT," + + "fEloVol FLOAT," + + "fConc FLOAT," + + "note VARCHAR(1000)," + + "fSymCellCycl INT," + + "theoMaxCap FLOAT," + "RefIDf INT," + "editDate TIMESTAMP," + "primary key(ID));"; diff --git a/src/main/java/de/dominikemmel/reflowlab/MainApp.java b/src/main/java/de/dominikemmel/reflowlab/MainApp.java index d72e73a..920e3a9 100644 --- a/src/main/java/de/dominikemmel/reflowlab/MainApp.java +++ b/src/main/java/de/dominikemmel/reflowlab/MainApp.java @@ -34,6 +34,8 @@ public class MainApp extends Application { @Override public void start(Stage primaryStage) throws IOException { + + Updates.updateDB(); Parent root = FXMLLoader.load(getClass().getResource("/de/dominikemmel/reflowlab/controller/maincontrol/fxml/main.fxml")); diff --git a/src/main/java/de/dominikemmel/reflowlab/Updates.java b/src/main/java/de/dominikemmel/reflowlab/Updates.java new file mode 100644 index 0000000..3adc2df --- /dev/null +++ b/src/main/java/de/dominikemmel/reflowlab/Updates.java @@ -0,0 +1,14 @@ +package de.dominikemmel.reflowlab; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + +public class Updates { + + public static void updateDB() { + + + } + +} 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 aca853d..926c068 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ActiveMaterialsController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ActiveMaterialsController.java @@ -50,6 +50,7 @@ public class ActiveMaterialsController implements javafx.fxml.Initializable { @FXML private TableColumn PH; @FXML private TableColumn E; @FXML private TableColumn EDITDATE; + @FXML private TableColumn Category; @FXML private TableColumn RefIDn; @FXML private TableColumn RefIDNumberH; @@ -69,6 +70,7 @@ public class ActiveMaterialsController implements javafx.fxml.Initializable { @FXML private TextFlow SaltC_TextFlow; @FXML private TextFlow PH_TextFlow; @FXML private TextFlow E_TextFlow; + @FXML private TextFlow Category_TextFlow; @FXML private TextFlow EDITDATE_TextFlow; @FXML private Button addActiveMaterial; @@ -110,6 +112,7 @@ public void reloadDataActiveMaterials() { objActiveMaterial.SaltC.set(res.getDouble("SaltC")); objActiveMaterial.PH.set(res.getDouble("PH")); objActiveMaterial.E.set(res.getDouble("E")); + objActiveMaterial.Category.set(res.getString("Category")); objActiveMaterial.RefIDn.set(res.getInt("RefIDn")); objActiveMaterial.RefIDNumberH.set(res.getInt("RefIDNumberH")); objActiveMaterial.RefIDCAM.set(res.getInt("RefIDCAM")); @@ -137,6 +140,7 @@ public void reloadDataActiveMaterials() { SaltC.setCellValueFactory(new PropertyValueFactory("SaltC")); PH.setCellValueFactory(new PropertyValueFactory("PH")); E.setCellValueFactory(new PropertyValueFactory("E")); + Category.setCellValueFactory(new PropertyValueFactory("Category")); EDITDATE.setCellValueFactory(new PropertyValueFactory("EDITDATE")); RefIDn.setCellValueFactory(new PropertyValueFactory("RefIDn")); RefIDNumberH.setCellValueFactory(new PropertyValueFactory("RefIDNumberH")); @@ -288,11 +292,17 @@ private void addColumnNames() { Text E1 = new Text("E"); E1.setStyle("-fx-font-weight: bold"); E1.setStyle("-fx-font-style: italic"); - Text E2 = new Text("� vs NHE / V"); + Text E2 = new Text(" vs NHE / V"); E2.setStyle("-fx-font-weight: bold"); E_TextFlow.getChildren().addAll(E1,E2); + //Category: + Text Category1 = new Text("Category"); + Category1.setStyle("-fx-font-weight: bold"); + + Category_TextFlow.getChildren().addAll(Category1); + //EDITDATE: Text EDITDATE1 = new Text("Date"); EDITDATE1.setStyle("-fx-font-weight: bold"); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/AddActiveMaterialController.java b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/AddActiveMaterialController.java index 0bcf591..260caff 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/AddActiveMaterialController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/AddActiveMaterialController.java @@ -29,6 +29,7 @@ public class AddActiveMaterialController implements javafx.fxml.Initializable { @FXML private TextField inputName; @FXML private TextField inputSTRUCTURALFORMULA; @FXML private TextField inputM; + @FXML private TextField inputCategory; @FXML private TextField inputN; @FXML private TextField inputNumberH; @FXML private TextField inputCAM; @@ -205,6 +206,7 @@ public void btnAddActiveMaterial(ActionEvent event) throws ClassNotFoundExceptio String inputName_Value = VariousMethods.getTextFieldInput(inputName, "stringInput"); String inputSTRUCTURALFORMULA_Value = VariousMethods.getTextFieldInput(inputSTRUCTURALFORMULA, "stringInput"); Double inputM_Value = VariousMethods.getTextFieldInput(inputM, "doubleInput"); + String inputCategory_Value = VariousMethods.getTextFieldInput(inputCategory, "stringInput"); Integer inputN_Value = VariousMethods.getTextFieldInput(inputN, "integerInput"); Integer inputNumberH_Value = VariousMethods.getTextFieldInput(inputNumberH, "integerInput"); Double inputCAM_Value = VariousMethods.getTextFieldInput(inputCAM, "doubleInput"); @@ -222,6 +224,7 @@ public void btnAddActiveMaterial(ActionEvent event) throws ClassNotFoundExceptio objActiveMaterial.NAME.set(inputName_Value); objActiveMaterial.STRUCTURALFORMULA.set(inputSTRUCTURALFORMULA_Value); objActiveMaterial.M.set(inputM_Value); + objActiveMaterial.Category.set(inputCategory_Value); objActiveMaterial.N.set(inputN_Value); objActiveMaterial.NumberH.set(inputNumberH_Value); objActiveMaterial.CAM.set(inputCAM_Value); @@ -234,10 +237,10 @@ public void btnAddActiveMaterial(ActionEvent event) throws ClassNotFoundExceptio try { Connection con = Database.getConnection("activeMaterial"); Statement state = con.createStatement(); - state.executeUpdate("INSERT INTO activeMaterial(ID, Abbreviation, Name, StructuralFormula, M, n, NumberH, CAM, Solvent, Salt, Saltc, pH, E, editDate)" + state.executeUpdate("INSERT INTO activeMaterial(ID, Abbreviation, Name, StructuralFormula, M, Category, n, NumberH, CAM, Solvent, Salt, Saltc, pH, E, editDate)" +" VALUES(DEFAULT, '"+objActiveMaterial.ABBREVIATION.getValue()+"', '" +objActiveMaterial.NAME.getValue()+"', '"+objActiveMaterial.STRUCTURALFORMULA.getValue()+"', " - +objActiveMaterial.M.getValue()+", "+objActiveMaterial.N.getValue()+", "+objActiveMaterial.NumberH.getValue()+", " + +objActiveMaterial.M.getValue()+", '"+objActiveMaterial.Category.getValue()+"', "+objActiveMaterial.N.getValue()+", "+objActiveMaterial.NumberH.getValue()+", " +objActiveMaterial.CAM.getValue()+", '"+objActiveMaterial.SOLVENT.getValue()+"', '" +objActiveMaterial.Salt.getValue()+"', " +objActiveMaterial.SaltC.getValue()+", "+objActiveMaterial.PH.getValue()+", " diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/EditActiveMaterialController.java b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/EditActiveMaterialController.java index aa57d1c..3de4dfa 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/EditActiveMaterialController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/EditActiveMaterialController.java @@ -29,6 +29,7 @@ public class EditActiveMaterialController implements javafx.fxml.Initializable @FXML private TextField inputName; @FXML private TextField inputSTRUCTURALFORMULA; @FXML private TextField inputM; + @FXML private TextField inputCategory; @FXML private TextField inputN; @FXML private TextField inputNumberH; @FXML private TextField inputCAM; @@ -67,6 +68,7 @@ public void setSelectionData(ObservableList selection) throws inputName.setText(selection.get(0).NAME.getValue()); inputSTRUCTURALFORMULA.setText(selection.get(0).STRUCTURALFORMULA.getValue()); inputM.setText(selection.get(0).M.getValue().toString()); + inputCategory.setText(selection.get(0).Category.getValue()); inputN.setText(selection.get(0).N.getValue().toString()); inputNumberH.setText(selection.get(0).NumberH.getValue().toString()); inputCAM.setText(selection.get(0).CAM.getValue().toString()); @@ -238,6 +240,7 @@ public void btnEditActiveMaterial(ActionEvent event) throws ClassNotFoundExcepti String inputName_Value = VariousMethods.getTextFieldInput(inputName, "stringInput"); String inputSTRUCTURALFORMULA_Value = VariousMethods.getTextFieldInput(inputSTRUCTURALFORMULA, "stringInput"); Double inputM_Value = VariousMethods.getTextFieldInput(inputM, "doubleInput"); + String inputCategory_Value = VariousMethods.getTextFieldInput(inputCategory, "stringInput"); Integer inputN_Value = VariousMethods.getTextFieldInput(inputN, "integerInput"); Integer inputNumberH_Value = VariousMethods.getTextFieldInput(inputNumberH, "integerInput"); Double inputCAM_Value = VariousMethods.getTextFieldInput(inputCAM, "doubleInput"); @@ -251,6 +254,7 @@ public void btnEditActiveMaterial(ActionEvent event) throws ClassNotFoundExcepti objActiveMaterial.NAME.set(inputName_Value); objActiveMaterial.STRUCTURALFORMULA.set(inputSTRUCTURALFORMULA_Value); objActiveMaterial.M.set(inputM_Value); + objActiveMaterial.Category.set(inputCategory_Value); objActiveMaterial.N.set(inputN_Value); objActiveMaterial.NumberH.set(inputNumberH_Value); objActiveMaterial.CAM.set(inputCAM_Value); @@ -266,8 +270,8 @@ public void btnEditActiveMaterial(ActionEvent event) throws ClassNotFoundExcepti state.executeUpdate("UPDATE activeMaterial " + "SET ID = "+selection.get(0).ID.getValue()+ ", Abbreviation = '"+objActiveMaterial.ABBREVIATION.getValue()+"', Name = '"+objActiveMaterial.NAME.getValue()+ - "', StructuralFormula = '"+objActiveMaterial.STRUCTURALFORMULA.getValue()+"', M = "+objActiveMaterial.M.getValue()+ - ", n = "+objActiveMaterial.N.getValue()+", NumberH = "+objActiveMaterial.NumberH.getValue()+ + "', StructuralFormula = '"+objActiveMaterial.STRUCTURALFORMULA.getValue()+"', M = "+objActiveMaterial.M.getValue()+ ", Category = '"+objActiveMaterial.Category.getValue()+ + "', n = "+objActiveMaterial.N.getValue()+", NumberH = "+objActiveMaterial.NumberH.getValue()+ ", CAM = "+objActiveMaterial.CAM.getValue()+", Solvent = '"+objActiveMaterial.SOLVENT.getValue()+ "', Salt = '"+objActiveMaterial.Salt.getValue()+ "', Saltc = "+objActiveMaterial.SaltC.getValue()+", pH = " diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ObjActiveMaterial.java b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ObjActiveMaterial.java index ff10b21..eb067a9 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ObjActiveMaterial.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/activematerials/ObjActiveMaterial.java @@ -22,6 +22,7 @@ public class ObjActiveMaterial { public DoubleProperty SaltC = new SimpleDoubleProperty(); public DoubleProperty PH = new SimpleDoubleProperty(); public DoubleProperty E = new SimpleDoubleProperty(); + public StringProperty Category = new SimpleStringProperty(); public StringProperty EDITDATE = new SimpleStringProperty(); public IntegerProperty RefIDn = new SimpleIntegerProperty(); public IntegerProperty RefIDNumberH = new SimpleIntegerProperty(); @@ -67,6 +68,9 @@ public DoubleProperty PHProperty() { public DoubleProperty EProperty() { return E; } + public StringProperty CategoryProperty() { + return Category; + } public StringProperty EDITDATEProperty() { return EDITDATE; } @@ -84,7 +88,7 @@ public IntegerProperty RefIDEProperty() { } // Using constructor to set values of properties. - public ObjActiveMaterial(int IDValue, String ABBREVIATIONValue, String NAMEValue, String STRUCTURALFORMULAValue, double MValue, int NValue, int NumberHValue, double CAMValue, String SOLVENTValue, String SaltValue, double SaltCValue, double PHValue, double EValue, String EDITDATEValue, int RefIDnValue, int RefIDNumberHValue, int RefIDCAMValue, int RefIDEValue) { + public ObjActiveMaterial(int IDValue, String ABBREVIATIONValue, String NAMEValue, String STRUCTURALFORMULAValue, double MValue, int NValue, int NumberHValue, double CAMValue, String SOLVENTValue, String SaltValue, double SaltCValue, double PHValue, double EValue, String CategoryValue, String EDITDATEValue, int RefIDnValue, int RefIDNumberHValue, int RefIDCAMValue, int RefIDEValue) { ID.set(IDValue); ABBREVIATION.set(ABBREVIATIONValue); NAME.set(NAMEValue); @@ -98,6 +102,7 @@ public ObjActiveMaterial(int IDValue, String ABBREVIATIONValue, String NAMEValue SaltC.set(SaltCValue); PH.set(PHValue); E.set(EValue); + Category.set(CategoryValue); EDITDATE.set(EDITDATEValue); RefIDn.set(RefIDnValue); RefIDNumberH.set(RefIDNumberHValue); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/AddElectrolytesController.java b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/AddElectrolytesController.java index 0a587a0..c886927 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/AddElectrolytesController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/AddElectrolytesController.java @@ -2,21 +2,27 @@ import java.net.URL; import java.sql.Connection; +import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ResourceBundle; import javafx.application.Platform; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import de.dominikemmel.reflowlab.Database; +import de.dominikemmel.reflowlab.MyConstants; import de.dominikemmel.reflowlab.VariousMethods; +import de.dominikemmel.reflowlab.controller.costanalysistool.CostAnalysisToolController; import de.dominikemmel.reflowlab.controller.references.ObjReference; import de.dominikemmel.reflowlab.controller.references.ReferencesController; @@ -51,6 +57,16 @@ public class AddElectrolytesController implements javafx.fxml.Initializable { private TextField inputdegRate; @FXML private TextField inputf; + @FXML + private TextField inputTheoMaxCap; + @FXML + private TextField inputNote; + @FXML + private TextField inputfEloVol; + @FXML + private TextField inputfConc; + @FXML + private CheckBox inputfSymCellCycl; @FXML private TextField inputRefDOIMaxSolubility; @@ -108,6 +124,9 @@ public class AddElectrolytesController implements javafx.fxml.Initializable { @FXML private Button btnInputRefF; + @FXML + private Button btnCalcQmax; + String table = "electrolyte"; @Override @@ -415,6 +434,48 @@ public void btnInputRefdegRateEvent(ActionEvent event) { inputRefF.setText(inputRefdegRate.getText()); } + @FXML + public void btnCalcQmaxEvent(ActionEvent event) { + + double vol = Double.valueOf(inputfEloVol.getText()) * Math.pow(10, -3); + double conc = Double.valueOf(inputfConc.getText()); + + int numberEl = 0; + + try { + + ResultSet res = Database.selectData("activeMaterial"); + + ObservableList dataActiveMaterial = FXCollections.observableArrayList(); + + while (res.next()) { + String sqlAbbrev = res.getString("ABBREVIATION"); + + if (sqlAbbrev.equals(inputActiveMaterial.getText())) { + int dataNumberEl = res.getInt("N"); + dataActiveMaterial.add(dataNumberEl); + } + } + + if (!dataActiveMaterial.isEmpty()) { + numberEl = dataActiveMaterial.get(0).intValue(); + } + + + } catch (ClassNotFoundException | SQLException e) { + e.printStackTrace(); + } + + // theo. max. capacity / mAh + double maxCap = 0; + if (numberEl > 0) { + maxCap = MyConstants.F * vol * conc * numberEl * Math.pow(10, 3) / (60 * 60); + } + + inputTheoMaxCap.setText(String.valueOf(maxCap)); + } + + // Event Listener on Button.onAction @FXML public void cancelAddElectrolytes(ActionEvent event) { @@ -441,6 +502,11 @@ public void addAddElectrolytes(ActionEvent event) throws ClassNotFoundException, Double inputAlphaRed_Value = VariousMethods.getTextFieldInput(inputAlphaRed, "doubleInput"); Double inputdegRate_Value = VariousMethods.getTextFieldInput(inputdegRate, "doubleInput"); Double inputf_Value = VariousMethods.getTextFieldInput(inputf, "doubleInput"); + Double inputTheoMaxCap_Value = VariousMethods.getTextFieldInput(inputTheoMaxCap, "doubleInput"); + String inputNote_Value = VariousMethods.getTextFieldInput(inputNote, "stringInput"); + Double inputfEloVol_Value = VariousMethods.getTextFieldInput(inputfEloVol, "doubleInput"); + Double inputfConc_Value = VariousMethods.getTextFieldInput(inputfConc, "doubleInput"); + Boolean inputfSymCellCycl_Value = inputfSymCellCycl.isSelected(); objElectrolytes.ActiveMaterial.set(inputActiveMaterial_Value); objElectrolytes.Solvent.set(inputSolvent_Value); @@ -456,18 +522,30 @@ public void addAddElectrolytes(ActionEvent event) throws ClassNotFoundException, objElectrolytes.AlphaRed.set(inputAlphaRed_Value); objElectrolytes.degRate.set(inputdegRate_Value); objElectrolytes.f.set(inputf_Value); + objElectrolytes.theoMaxCap.set(inputTheoMaxCap_Value); + objElectrolytes.note.set(inputNote_Value); + objElectrolytes.fEloVol.set(inputfEloVol_Value); + objElectrolytes.fConc.set(inputfConc_Value); + objElectrolytes.fSymCellCycl.set(inputfSymCellCycl_Value); + + double fSymCellCycl_sql = 0; + if (inputfSymCellCycl_Value) { + fSymCellCycl_sql = 1; + } else { + fSymCellCycl_sql = 0; + } try { Connection con = Database.getConnection("electrolyte"); Statement state = con.createStatement(); - state.executeUpdate("INSERT INTO electrolyte(ID, ActiveMaterial, Solvent, Salt, cSalt, pH, maxSolubility, DOx, DRed, kOx, AlphaOx, kRed, AlphaRed, degRate, f, editDate)" + state.executeUpdate("INSERT INTO electrolyte(ID, ActiveMaterial, Solvent, Salt, cSalt, pH, maxSolubility, DOx, DRed, kOx, AlphaOx, kRed, AlphaRed, degRate, f, theoMaxCap, fEloVol, fConc, note, fSymCellCycl, editDate)" +" VALUES(DEFAULT, '"+objElectrolytes.ActiveMaterial.getValue()+"', '" +objElectrolytes.Solvent.getValue()+"', '"+objElectrolytes.Salt.getValue()+"', " +objElectrolytes.cSalt.getValue()+", " +objElectrolytes.pH.getValue()+", "+objElectrolytes.maxSolubility.getValue()+", " +objElectrolytes.DOx.getValue()+", "+objElectrolytes.DRed.getValue()+", "+objElectrolytes.kOx.getValue()+", " +objElectrolytes.AlphaOx.getValue()+", "+objElectrolytes.kRed.getValue()+", "+objElectrolytes.AlphaRed.getValue()+", " - +objElectrolytes.degRate.getValue()+", "+objElectrolytes.f.getValue()+", CURRENT_TIMESTAMP)"); + +objElectrolytes.degRate.getValue()+", "+objElectrolytes.f.getValue()+", "+objElectrolytes.theoMaxCap.getValue()+", "+objElectrolytes.fEloVol.getValue()+", "+objElectrolytes.fConc.getValue()+", '"+objElectrolytes.note.getValue()+"', "+fSymCellCycl_sql+", CURRENT_TIMESTAMP)"); } catch (ClassNotFoundException e) { e.printStackTrace(); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/EditElectrolytesController.java b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/EditElectrolytesController.java index 7e36060..d3b1fdf 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/EditElectrolytesController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/EditElectrolytesController.java @@ -2,21 +2,25 @@ import java.net.URL; import java.sql.Connection; +import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ResourceBundle; import javafx.application.Platform; +import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import de.dominikemmel.reflowlab.Database; +import de.dominikemmel.reflowlab.MyConstants; import de.dominikemmel.reflowlab.VariousMethods; import de.dominikemmel.reflowlab.controller.references.ObjReference; import de.dominikemmel.reflowlab.controller.references.ReferencesController; @@ -57,6 +61,16 @@ public class EditElectrolytesController implements javafx.fxml.Initializable { private TextField inputdegRate; @FXML private TextField inputf; + @FXML + private TextField inputTheoMaxCap; + @FXML + private TextField inputNote; + @FXML + private TextField inputfEloVol; + @FXML + private TextField inputfConc; + @FXML + private CheckBox inputfSymCellCycl; @FXML private TextField inputRefDOIMaxSolubility; @@ -114,6 +128,9 @@ public class EditElectrolytesController implements javafx.fxml.Initializable { @FXML private Button btnInputRefF; + @FXML + private Button btnCalcQmax; + String table = "electrolyte"; @Override @@ -422,6 +439,11 @@ public void setSelectionData(ObservableList selection) throws C inputAlphaRed.setText(selection.get(0).AlphaRed.getValue().toString()); inputdegRate.setText(selection.get(0).degRate.getValue().toString()); inputf.setText(selection.get(0).f.getValue().toString()); + inputTheoMaxCap.setText(selection.get(0).theoMaxCap.getValue().toString()); + inputNote.setText(selection.get(0).note.getValue()); + inputfEloVol.setText(selection.get(0).fEloVol.getValue().toString()); + inputfConc.setText(selection.get(0).fConc.getValue().toString()); + inputfSymCellCycl.setSelected(selection.get(0).fSymCellCycl.getValue()); ObjReference objReferenceMaxSolubility = ReferencesController.checkRefID(selection.get(0).RefIDmaxSolubility.getValue()); @@ -479,6 +501,48 @@ public void setSelectionData(ObservableList selection) throws C } + + @FXML + public void btnCalcQmaxEvent(ActionEvent event) { + + double vol = Double.valueOf(inputfEloVol.getText()) * Math.pow(10, -3); + double conc = Double.valueOf(inputfConc.getText()); + + int numberEl = 0; + + try { + + ResultSet res = Database.selectData("activeMaterial"); + + ObservableList dataActiveMaterial = FXCollections.observableArrayList(); + + while (res.next()) { + String sqlAbbrev = res.getString("ABBREVIATION"); + + if (sqlAbbrev.equals(inputActiveMaterial.getText())) { + int dataNumberEl = res.getInt("N"); + dataActiveMaterial.add(dataNumberEl); + } + } + + if (!dataActiveMaterial.isEmpty()) { + numberEl = dataActiveMaterial.get(0).intValue(); + } + + + } catch (ClassNotFoundException | SQLException e) { + e.printStackTrace(); + } + + // theo. max. capacity / mAh + double maxCap = 0; + if (numberEl > 0) { + maxCap = MyConstants.F * vol * conc * numberEl * Math.pow(10, 3) / (60 * 60); + } + + inputTheoMaxCap.setText(String.valueOf(maxCap)); + } + // Event Listener on Button.onAction @@ -506,6 +570,11 @@ public void editEditElectrolytes(ActionEvent event) throws ClassNotFoundExceptio Double inputAlphaRed_Value = VariousMethods.getTextFieldInput(inputAlphaRed, "doubleInput"); Double inputdegRate_Value = VariousMethods.getTextFieldInput(inputdegRate, "doubleInput"); Double inputf_Value = VariousMethods.getTextFieldInput(inputf, "doubleInput"); + Double inputTheoMaxCap_Value = VariousMethods.getTextFieldInput(inputTheoMaxCap, "doubleInput"); + String inputNote_Value = VariousMethods.getTextFieldInput(inputNote, "stringInput"); + Double inputfEloVol_Value = VariousMethods.getTextFieldInput(inputfEloVol, "doubleInput"); + Double inputfConc_Value = VariousMethods.getTextFieldInput(inputfConc, "doubleInput"); + Boolean inputfSymCellCycl_Value = inputfSymCellCycl.isSelected(); objElectrolytes.ActiveMaterial.set(inputActiveMaterial_Value); objElectrolytes.Solvent.set(inputSolvent_Value); @@ -521,6 +590,18 @@ public void editEditElectrolytes(ActionEvent event) throws ClassNotFoundExceptio objElectrolytes.AlphaRed.set(inputAlphaRed_Value); objElectrolytes.degRate.set(inputdegRate_Value); objElectrolytes.f.set(inputf_Value); + objElectrolytes.theoMaxCap.set(inputTheoMaxCap_Value); + objElectrolytes.note.set(inputNote_Value); + objElectrolytes.fEloVol.set(inputfEloVol_Value); + objElectrolytes.fConc.set(inputfConc_Value); + objElectrolytes.fSymCellCycl.set(inputfSymCellCycl_Value); + + double fSymCellCycl_sql = 0; + if (inputfSymCellCycl_Value) { + fSymCellCycl_sql = 1; + } else { + fSymCellCycl_sql = 0; + } try { Connection con = Database.getConnection("electrolyte"); @@ -539,9 +620,16 @@ public void editEditElectrolytes(ActionEvent event) throws ClassNotFoundExceptio +", kRed = "+objElectrolytes.kRed.getValue() +", AlphaRed = "+objElectrolytes.AlphaRed.getValue() +", f = "+objElectrolytes.f.getValue() - +", degRate = "+objElectrolytes.degRate.getValue()+", editDate = CURRENT_TIMESTAMP" + +", theoMaxCap = "+objElectrolytes.theoMaxCap.getValue() + +", degRate = "+objElectrolytes.degRate.getValue() + +", fEloVol = "+objElectrolytes.fEloVol.getValue() + +", fConc = "+objElectrolytes.fConc.getValue() + +", note = '"+objElectrolytes.note.getValue() + +"', fSymCellCycl = "+fSymCellCycl_sql + +", editDate = CURRENT_TIMESTAMP" + " WHERE ID = "+selection.get(0).ID.getValue()+""); + } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } 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 e6889eb..6ca7fc0 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ElectrolytesController.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ElectrolytesController.java @@ -49,6 +49,11 @@ public class ElectrolytesController implements javafx.fxml.Initializable { @FXML private TableColumn AlphaRed; @FXML private TableColumn degRate; @FXML private TableColumn f; + @FXML private TableColumn fEloVol; + @FXML private TableColumn fConc; + @FXML private TableColumn note; + @FXML private TableColumn fSymCellCycl; + @FXML private TableColumn theoMaxCap; @FXML private TableColumn editDate; @FXML private TableColumn RefIDmaxSolubility; @@ -76,6 +81,11 @@ public class ElectrolytesController implements javafx.fxml.Initializable { @FXML private TextFlow AlphaRed_TextFlow; @FXML private TextFlow degRate_TextFlow; @FXML private TextFlow f_TextFlow; + @FXML private TextFlow fEloVol_TextFlow; + @FXML private TextFlow fConc_TextFlow; + @FXML private TextFlow note_TextFlow; + @FXML private TextFlow fSymCellCycl_TextFlow; + @FXML private TextFlow theoMaxCap_TextFlow; @FXML private TextFlow editDate_TextFlow; @@ -116,6 +126,16 @@ public void reloadDataElectrolytes() { objElectrolytes.AlphaRed.set(res.getDouble("AlphaRed")); objElectrolytes.degRate.set(res.getDouble("degRate")); objElectrolytes.f.set(res.getDouble("f")); + objElectrolytes.fEloVol.set(res.getDouble("fEloVol")); + objElectrolytes.fConc.set(res.getDouble("fConc")); + objElectrolytes.note.set(res.getString("note")); + if (res.getInt("fSymCellCycl") == 1) { + objElectrolytes.fSymCellCycl.set(true); + } else { + objElectrolytes.fSymCellCycl.set(false); + } + + objElectrolytes.theoMaxCap.set(res.getDouble("theoMaxCap")); objElectrolytes.RefIDmaxSolubility.set(res.getInt("RefIDmaxSolubility")); objElectrolytes.RefIDDOx.set(res.getInt("RefIDDOx")); @@ -151,6 +171,11 @@ public void reloadDataElectrolytes() { AlphaRed.setCellValueFactory(new PropertyValueFactory("AlphaRed")); degRate.setCellValueFactory(new PropertyValueFactory("degRate")); f.setCellValueFactory(new PropertyValueFactory("f")); + fEloVol.setCellValueFactory(new PropertyValueFactory("fEloVol")); + fConc.setCellValueFactory(new PropertyValueFactory("fConc")); + note.setCellValueFactory(new PropertyValueFactory("note")); + fSymCellCycl.setCellValueFactory(new PropertyValueFactory("fSymCellCycl")); + theoMaxCap.setCellValueFactory(new PropertyValueFactory("theoMaxCap")); editDate.setCellValueFactory(new PropertyValueFactory("editDate")); RefIDmaxSolubility.setCellValueFactory(new PropertyValueFactory("RefIDmaxSolubility")); @@ -334,10 +359,10 @@ private void addColumnNames() { kred2.setStyle("-fx-font-weight: bold"); Text kred4 = new Text(" s"); kred4.setStyle("-fx-font-weight: bold"); - Text kred5 = new Text("-1"); + Text kred5 = new Text("⁻¹"); kred5.setStyle("-fx-font-weight: bold"); - kred5.setTranslateY(kred1.getFont().getSize() * -0.3); - kred5.setFont(Font.font(kred2.getFont().getStyle(),kred2.getFont().getSize()*0.75)); +// kred5.setTranslateY(kred4.getFont().getSize() * -0.3); +// kred5.setFont(Font.font(kred4.getFont().getStyle(),kred4.getFont().getSize()*0.75)); kRed_TextFlow.getChildren().addAll(kred1,kred2,kred4,kred5); @@ -362,6 +387,64 @@ private void addColumnNames() { f3.setFont(Font.font(f1.getFont().getStyle(),f1.getFont().getSize()*0.75)); f_TextFlow.getChildren().addAll(f1, f2, f3); + + //fEloVol: + Text fEloVol1 = new Text("V"); + fEloVol1.setStyle("-fx-font-weight: bold"); + fEloVol1.setStyle("-fx-font-style: italic"); + Text fEloVol2 = new Text("theo., max., cap."); + fEloVol2.setStyle("-fx-font-weight: bold"); + fEloVol2.setTranslateY(fEloVol1.getFont().getSize() * 0.3); + fEloVol2.setFont(Font.font(fEloVol1.getFont().getStyle(),fEloVol1.getFont().getSize()*0.75)); + Text fEloVol3 = new Text(" / mL"); + fEloVol3.setStyle("-fx-font-weight: bold"); + + fEloVol_TextFlow.getChildren().addAll(fEloVol1, fEloVol2, fEloVol3); + + //fConc: + Text fConc1 = new Text("c"); + fConc1.setStyle("-fx-font-weight: bold"); + fConc1.setStyle("-fx-font-style: italic"); + Text fConc2 = new Text("theo., max., cap."); + fConc2.setStyle("-fx-font-weight: bold"); + fConc2.setTranslateY(fConc1.getFont().getSize() * 0.3); + fConc2.setFont(Font.font(fConc1.getFont().getStyle(),fConc1.getFont().getSize()*0.75)); + Text fConc3 = new Text(" / mol L"); + fConc3.setStyle("-fx-font-weight: bold"); + Text fConc4 = new Text("-1"); + fConc4.setStyle("-fx-font-weight: bold"); + fConc4.setTranslateY(fConc1.getFont().getSize() * -0.3); + fConc4.setFont(Font.font(fConc1.getFont().getStyle(),fConc1.getFont().getSize()*0.75)); + + fConc_TextFlow.getChildren().addAll(fConc1, fConc2, fConc3, fConc4); + + //note: + Text note1 = new Text("note"); + note1.setStyle("-fx-font-weight: bold"); + + note_TextFlow.getChildren().addAll(note1); + + //fSymCellCycl: + Text fSymCellCycl1 = new Text("sym. cyclization?"); + fSymCellCycl1.setStyle("-fx-font-weight: bold"); + + fSymCellCycl_TextFlow.getChildren().addAll(fSymCellCycl1); + + //theoMaxCap: + Text theoMaxCap1 = new Text("q"); + theoMaxCap1.setStyle("-fx-font-weight: bold"); + theoMaxCap1.setStyle("-fx-font-style: italic"); + Text theoMaxCap2 = new Text("max., theo."); + theoMaxCap2.setStyle("-fx-font-weight: bold"); + theoMaxCap2.setTranslateY(theoMaxCap1.getFont().getSize() * 0.3); + Text theoMaxCap3 = new Text("/ mAh L"); + theoMaxCap3.setStyle("-fx-font-weight: bold"); + Text theoMaxCap4 = new Text("-1"); + theoMaxCap4.setStyle("-fx-font-weight: bold"); + theoMaxCap4.setTranslateY(theoMaxCap1.getFont().getSize() * -0.3); + theoMaxCap4.setFont(Font.font(theoMaxCap1.getFont().getStyle(),theoMaxCap1.getFont().getSize()*0.75)); + + theoMaxCap_TextFlow.getChildren().addAll(theoMaxCap1, theoMaxCap2, theoMaxCap3, theoMaxCap4); //editDate: Text editDate1 = new Text("Date"); diff --git a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ObjElectrolytes.java b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ObjElectrolytes.java index 3527233..e682f00 100644 --- a/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ObjElectrolytes.java +++ b/src/main/java/de/dominikemmel/reflowlab/controller/electrolytes/ObjElectrolytes.java @@ -1,7 +1,9 @@ package de.dominikemmel.reflowlab.controller.electrolytes; +import javafx.beans.property.BooleanProperty; import javafx.beans.property.DoubleProperty; import javafx.beans.property.IntegerProperty; +import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; @@ -24,6 +26,11 @@ public class ObjElectrolytes { public DoubleProperty AlphaRed = new SimpleDoubleProperty(); public DoubleProperty degRate = new SimpleDoubleProperty(); public DoubleProperty f = new SimpleDoubleProperty(); + public DoubleProperty fEloVol = new SimpleDoubleProperty(); + public DoubleProperty fConc = new SimpleDoubleProperty(); + public StringProperty note = new SimpleStringProperty(); + public BooleanProperty fSymCellCycl = new SimpleBooleanProperty(); + public DoubleProperty theoMaxCap = new SimpleDoubleProperty(); public StringProperty editDate = new SimpleStringProperty(); public IntegerProperty RefIDmaxSolubility = new SimpleIntegerProperty(); @@ -81,6 +88,21 @@ public DoubleProperty degRateProperty() { public DoubleProperty fProperty() { return f; } + public DoubleProperty fEloVolProperty() { + return fEloVol; + } + public DoubleProperty fConcProperty() { + return fConc; + } + public StringProperty noteProperty() { + return note; + } + public BooleanProperty fSymCellCyclProperty() { + return fSymCellCycl; + } + public DoubleProperty theoMaxCapProperty() { + return theoMaxCap; + } public StringProperty editDateProperty() { return editDate; } @@ -114,7 +136,7 @@ public IntegerProperty RefIDfProperty() { } // Using constructor to set values of properties. - public ObjElectrolytes(int IDValue, String ActiveMaterialValue, String SolventValue, String SaltValue, double cSaltValue, double pHValue, double maxSolubilityValue, double DOxValue, double DRedValue, double kOxValue, double AlphaOxValue, double kRedValue, double AlphaRedValue, double degRateValue, double fValue, String editDateValue, int RefIDmaxSolubilityValue, int RefIDDOxValue, int RefIDDRedValue, int RefIDkOxValue, int RefIDAlphaOxValue, int RefIDkRedValue, int RefIDAlphaRedValue, int RefIDdegRateValue, int RefIDfValue) { + public ObjElectrolytes(int IDValue, String ActiveMaterialValue, String SolventValue, String SaltValue, double cSaltValue, double pHValue, double maxSolubilityValue, double DOxValue, double DRedValue, double kOxValue, double AlphaOxValue, double kRedValue, double AlphaRedValue, double degRateValue, double fValue, double fEloVolValue, double fConcValue, String noteValue, boolean fSymCellCyclValue, double theoMaxCapValue, String editDateValue, int RefIDmaxSolubilityValue, int RefIDDOxValue, int RefIDDRedValue, int RefIDkOxValue, int RefIDAlphaOxValue, int RefIDkRedValue, int RefIDAlphaRedValue, int RefIDdegRateValue, int RefIDfValue) { ID.set(IDValue); ActiveMaterial.set(ActiveMaterialValue); Solvent.set(SolventValue); @@ -130,6 +152,11 @@ public ObjElectrolytes(int IDValue, String ActiveMaterialValue, String SolventVa AlphaRed.set(AlphaRedValue); degRate.set(degRateValue); f.set(fValue); + fEloVol.set(fEloVolValue); + fConc.set(fConcValue); + note.set(noteValue); + fSymCellCycl.set(fSymCellCyclValue); + theoMaxCap.set(theoMaxCapValue); editDate.set(editDateValue); RefIDmaxSolubility.set(RefIDmaxSolubilityValue); diff --git a/src/main/resources/de/dominikemmel/reflowlab/controller/activematerials/fxml/activeMaterials.fxml b/src/main/resources/de/dominikemmel/reflowlab/controller/activematerials/fxml/activeMaterials.fxml index 6c87369..387de3f 100644 --- a/src/main/resources/de/dominikemmel/reflowlab/controller/activematerials/fxml/activeMaterials.fxml +++ b/src/main/resources/de/dominikemmel/reflowlab/controller/activematerials/fxml/activeMaterials.fxml @@ -2,6 +2,7 @@ + @@ -9,179 +10,192 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + - + - - - - - - + - + - - - - - - + - + - - - - - - + - + - - - - - - + - + - - - - - - + - + - - - - - - + - + - - - - - - + - + - - - - - - + - + - - - - - - + - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +