From 1b709ffba017d6ee1280bcc40871de0da5381955 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:17:48 +0000 Subject: [PATCH 1/5] added possibility to update table --- .../neqsim/util/database/NeqSimDataBase.java | 25 +++++++++++++++++-- src/main/resources/data/COMP.csv | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/main/java/neqsim/util/database/NeqSimDataBase.java b/src/main/java/neqsim/util/database/NeqSimDataBase.java index b3bc2fe90..b761904d5 100644 --- a/src/main/java/neqsim/util/database/NeqSimDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimDataBase.java @@ -357,6 +357,8 @@ public static void main(String[] args) { // NeqSimDataBase.initH2DatabaseFromCSVfiles(); // NeqSimDataBase.initDatabaseFromCSVfiles(); NeqSimDataBase database = new NeqSimDataBase(); + NeqSimDataBase.updateTable("COMP", "/workspaces/neqsim/src/main/resources/data/COMP.csv"); + try (ResultSet dataSet = database.getResultSet("SELECT * FROM comp WHERE NAME='methane'")) { dataSet.next(); @@ -430,6 +432,25 @@ public static boolean hasComponent(String compName) { } } + public static void updateTable(String tableName, String path) { + neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase(); + String sqlString = "CREATE TABLE " + tableName + " AS SELECT * FROM CSVREAD('" + path + "')"; + try { + database.execute("DROP TABLE " + tableName); + database.execute(sqlString); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (database.getStatement() != null) { + database.getStatement().close(); + } + } catch (Exception ex) { + logger.error("error closing database.....", ex); + } + } + } + public static void initH2DatabaseFromCSVfiles() { neqsim.util.database.NeqSimDataBase.connectionString = "jdbc:h2:mem:neqsimthermodatabase;DB_CLOSE_DELAY=-1"; @@ -441,8 +462,8 @@ public static void initH2DatabaseFromCSVfiles() { // Statement stmn = con.createStatement(); // stmn.execute(defaultDatabaseRootRoot) - String createCOMP = "CREATE TABLE comp AS SELECT * FROM CSVREAD('classpath:/data/COMP.csv')"; - String createINTER = "CREATE TABLE inter AS SELECT * FROM CSVREAD('classpath:/data/INTER.csv')"; + String createCOMP = "CREATE TABLE COMP AS SELECT * FROM CSVREAD('classpath:/data/COMP.csv')"; + String createINTER = "CREATE TABLE INTER AS SELECT * FROM CSVREAD('classpath:/data/INTER.csv')"; String createElement = "CREATE TABLE element AS SELECT * FROM CSVREAD('classpath:/data/element.csv')"; String create_iso6976 = diff --git a/src/main/resources/data/COMP.csv b/src/main/resources/data/COMP.csv index 94878c324..d7b517a1f 100644 --- a/src/main/resources/data/COMP.csv +++ b/src/main/resources/data/COMP.csv @@ -192,4 +192,4 @@ 1184,"cis-14-DM-cy-C6","624-29-3","HC",147,"C",112.220000000,0.422182073,325.000000000,29.640000000,0.233980000,124.326013183,16.043000000,99.000000000,"Classic",66909.600000000,-68.400000000,0.897300000,-0.000513700,0.000000109,0.000000000,"log",39.205000000,-1324.400000000,-3.436600000,0.000031019,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2.520000000,155.809006022,0.406998625,3,-26.870000000,1150.000000000,0.187000000,-0.000521000,-50500.000000000,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0,"solute",900.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.303000000,-0.000605000,-0.000003200,77.300000000,941.000000000,452.000000000,0.116656057,90.690000000,90.650000000,-74520.000000000,186.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,10200000.0000000,0.261000000,-0.147000000,0.222000000,0.000000000,0.100000000,0.585700000,-0.720600000,1.289900000,0.000000000,0.000000000,0.000000000,0.122841598,0.914470789,2.741978611,0,"0",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4.186260000,1,1.000000000,-6.680820000,0.000000000,9700,0.000015293,0.047920000,1594.000000000,0.012440000,2952.000000000,0.002317000,2777.000000000,1.076000000,1323.000000000,"yes",1.000000000,3.703900119,150.029998779,0.000000000,0.000000000,3.190710941,155.809006022,0.406998625,1.000000000,0,900.000000000,0.000621000,2760.000000000,0.421000000,1963.100000000,0.004048680,2636.750000000,0.295270000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.628820000,0.701140000,-0.784370000,0.000000000 1185,"trans-14-DM-cy-C6","2207-04-7","HC",147,"C",112.220000000,0.422182073,316.667016601,29.640000000,0.233980000,119.356011962,16.043000000,99.000000000,"Classic",66909.600000000,-68.400000000,0.897300000,-0.000513700,0.000000109,0.000000000,"log",39.205000000,-1324.400000000,-3.436600000,0.000031019,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2.520000000,155.809006022,0.406998625,3,-26.870000000,1150.000000000,0.187000000,-0.000521000,-50500.000000000,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0,"solute",900.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.303000000,-0.000605000,-0.000003200,77.300000000,941.000000000,452.000000000,0.116656057,90.690000000,90.650000000,-74520.000000000,186.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,10200000.0000000,0.261000000,-0.147000000,0.222000000,0.000000000,0.100000000,0.585700000,-0.720600000,1.289900000,0.000000000,0.000000000,0.000000000,0.122841598,0.914470789,2.741978611,0,"0",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4.186260000,1,1.000000000,-6.680820000,0.000000000,9700,0.000015293,0.047920000,1594.000000000,0.012440000,2952.000000000,0.002317000,2777.000000000,1.076000000,1323.000000000,"yes",1.000000000,3.703900119,150.029998779,0.000000000,0.000000000,3.190710941,155.809006022,0.406998625,1.000000000,0,900.000000000,0.000621000,2760.000000000,0.421000000,1963.100000000,0.004048680,2636.750000000,0.295270000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.628820000,0.701140000,-0.784370000,0.000000000 1186,"PG","57-55-6","glycol",1186,"propyleneglycol",76.095000000,1.036000000,352.850000000,61.000000000,1.102000000,188.200000000,76.095000000,239.000000000,"Classic",32022.600000000,35.700000000,0.248400000,-0.000149700,0.000000030,0.000000000,"exp",13.629900000,6022.180000000,-28.250000000,0.000000000,0.000000000,2.308200000,0.215000000,0.248800000,0.000000000,3.626000000,481.800000000,0.000000000,3,-23.155244944,5694.484212533,0.023081509,0.000000000,57900.000000000,-19.290540000,29814.530000000,-0.019678500,0.013189000,0.031144000,0,"solvent",0.000000000,0.000000000,0.000000000,0.000000000,0.654009012,-3.955117195,3.671191916,0.517338954,-0.000798169,0.000000064,133.328650000,9958.000000000,904.000000000,0.000002420,260.150000000,260.150000000,-388000.000000000,324.000000000,21.400000000,0.000000000,0.000000000,0.000000000,0.000000000,1.315100000,0.251250000,719.700000000,0.218700000,0.000000000,82900000.0000000,0.427000000,0.000000000,0.000000000,0.000000000,1.117000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4,"4C",0.000000000,0.000000000,0.019000000,17442.000000000,138360.000000000,6.750000000,0.937200000,108190.000000000,5.140000000,0.674400000,0.051400000,1,17.090887000,-7800.000000000,0.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,"no",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,3.626000000,481.800000000,0.000000000,1.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,35540.000000000,436.780000000,-0.184860000,0.000000000,0.000000000,35540.000000000,436.780000000,-0.184860000,0.000000000,0.000000000,0.910030000,1.349960000,-1.890020000,151.817427819 -1187,"ammonia","7664-41-7","other",1187,"Nh3",17.031,0.73,132.25,113.0,0.250,-33.35,17.031,99.000000000,"Classic",11133.000000000,39.192196000,-0.058081604,0.000350102,-0.000000369,1.276199e-10,"pow10",5.202770000,1580.080000000,239.500000000,0.000000000,0.000000000,1.700000000,0.215000000,0.200000000,0.000000000,3.626000000,481.800000000,0.000000000,3,-39.350000000,4826.000000000,0.109100000,-0.000113000,57900.000000000,-19.290500000,29814.500000000,-0.019678000,0.013189000,0.031144000,0,"solvent",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,-0.384000000,0.005250000,-0.000006370,73.069489067,3177.000000000,1000.000000000,0.006110000,175.500000000,175.500000000,-242000.000000000,189.000000000,30.585000000,0.000000000,0.000000000,0.000000000,0.000000000,2.288000000,0.268500000,512.640000000,0.245300000,0.000000000,52100000.0000000,0.320000000,-0.212000000,0.258000000,0.000000000,0.797000000,1.437100000,-0.799420000,0.327800000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2,"2B",0.000000000,0.000000000,0.016100000,24591.000000000,40531.000000000,3.097800000,0.431020000,47052.000000000,3.300000000,0.903700000,0.044900000,1,17.387107060,-7582.406220000,0.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,"no",1.525500000,3.230000000,188.900000000,0.035176000,24106.443000000,3.626000000,481.800000000,0.000000000,1.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,-12706.000000000,958.780000000,-5.233200000,0.013152000,0.000000000,105800.000000000,-362.230000000,0.937900000,0.000000000,0.000000000,1.224003000,-0.273500000,-0.398230000,87.543852818 +1187,"ammonia","7664-41-7","other",1187,"NH3",17.031,0.73,132.25,113.0,0.250,-33.35,17.031,99.000000000,"Classic",11133.000000000,39.192196000,-0.058081604,0.000350102,-0.000000369,1.276199e-10,"pow10",5.202770000,1580.080000000,239.500000000,0.000000000,0.000000000,1.700000000,0.215000000,0.200000000,0.000000000,3.626000000,481.800000000,0.000000000,3,-39.350000000,4826.000000000,0.109100000,-0.000113000,57900.000000000,-19.290500000,29814.500000000,-0.019678000,0.013189000,0.031144000,0,"solvent",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,-0.384000000,0.005250000,-0.000006370,73.069489067,3177.000000000,1000.000000000,0.006110000,175.500000000,175.500000000,-242000.000000000,189.000000000,30.585000000,0.000000000,0.000000000,0.000000000,0.000000000,2.288000000,0.268500000,512.640000000,0.245300000,0.000000000,52100000.0000000,0.320000000,-0.212000000,0.258000000,0.000000000,0.797000000,1.437100000,-0.799420000,0.327800000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2,"2B",0.000000000,0.000000000,0.016100000,24591.000000000,40531.000000000,3.097800000,0.431020000,47052.000000000,3.300000000,0.903700000,0.044900000,1,17.387107060,-7582.406220000,0.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,"no",1.525500000,3.230000000,188.900000000,0.035176000,24106.443000000,3.626000000,481.800000000,0.000000000,1.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,-12706.000000000,958.780000000,-5.233200000,0.013152000,0.000000000,105800.000000000,-362.230000000,0.937900000,0.000000000,0.000000000,1.224003000,-0.273500000,-0.398230000,87.543852818 From a04213dfb8bd8f1484e5c46a1cc5356d7c43f640 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 3 Apr 2023 11:15:43 +0000 Subject: [PATCH 2/5] addd ammonia --- .../neqsim/thermo/component/Component.java | 14 +++++++++- .../thermo/component/ComponentInterface.java | 15 ++++++----- src/main/resources/data/COMP.csv | 2 +- .../thermo/component/NewComponentTest.java | 26 +++++++++++++++++++ 4 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 src/test/java/neqsim/thermo/component/NewComponentTest.java diff --git a/src/main/java/neqsim/thermo/component/Component.java b/src/main/java/neqsim/thermo/component/Component.java index b1b28475b..e3b65ac9e 100644 --- a/src/main/java/neqsim/thermo/component/Component.java +++ b/src/main/java/neqsim/thermo/component/Component.java @@ -1203,7 +1203,19 @@ public double getAntoineVaporPressure(double temp) { // gases // (poling // 5th ed) - } else if (antoineLiqVapPresType.equals("exp") || antoineLiqVapPresType.equals("log")) { + } else if (antoineLiqVapPresType.equals("pow10KPa")) { + return Math.pow(10.0, AntoineA - (AntoineB / (temp + AntoineC)))/1.0e5; // equation + // and + // parameter + // from + // properties + // o liquids + // and + // gases + // (poling + // 5th ed) + } + else if (antoineLiqVapPresType.equals("exp") || antoineLiqVapPresType.equals("log")) { return Math.exp(AntoineA - (AntoineB / (temp + AntoineC))); // equation and parameter // from properties o // liquids and gases (poling diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java index 3eab71b9d..dd10dfafa 100644 --- a/src/main/java/neqsim/thermo/component/ComponentInterface.java +++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java @@ -763,7 +763,7 @@ public void Finit(PhaseInterface phase, double temperature, double pressure, /** *

- * getx. + * The mole fraction of a component in the actual phase *

* * @return a double @@ -772,7 +772,7 @@ public void Finit(PhaseInterface phase, double temperature, double pressure, /** *

- * getz. + * The mole fraction of a component in the total fluid *

* * @return a double @@ -781,7 +781,7 @@ public void Finit(PhaseInterface phase, double temperature, double pressure, /** *

- * getK. + * The distribution coefficient y/x between gas and lidquid for a component *

* * @return a double @@ -790,7 +790,7 @@ public void Finit(PhaseInterface phase, double temperature, double pressure, /** *

- * getTC. + * Returns the critical temperature of the component *

* * @return a double @@ -1075,7 +1075,9 @@ public void Finit(PhaseInterface phase, double temperature, double pressure, /** *

- * getCp0. + * Return the ideal-gas molar heat capacity of a chemical using polynomial regressed coefficients + * as described by Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: + * McGraw-Hill Professional, 2000. *

* * @param temperature a double @@ -1300,7 +1302,8 @@ public void Finit(PhaseInterface phase, double temperature, double pressure, /** *

- * getDebyeDipoleMoment. + * This function handles the retrieval of a chemical’s dipole moment. Dipole moment, [debye] as a + * double *

* * @return a double diff --git a/src/main/resources/data/COMP.csv b/src/main/resources/data/COMP.csv index d7b517a1f..5188cc8f2 100644 --- a/src/main/resources/data/COMP.csv +++ b/src/main/resources/data/COMP.csv @@ -192,4 +192,4 @@ 1184,"cis-14-DM-cy-C6","624-29-3","HC",147,"C",112.220000000,0.422182073,325.000000000,29.640000000,0.233980000,124.326013183,16.043000000,99.000000000,"Classic",66909.600000000,-68.400000000,0.897300000,-0.000513700,0.000000109,0.000000000,"log",39.205000000,-1324.400000000,-3.436600000,0.000031019,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2.520000000,155.809006022,0.406998625,3,-26.870000000,1150.000000000,0.187000000,-0.000521000,-50500.000000000,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0,"solute",900.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.303000000,-0.000605000,-0.000003200,77.300000000,941.000000000,452.000000000,0.116656057,90.690000000,90.650000000,-74520.000000000,186.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,10200000.0000000,0.261000000,-0.147000000,0.222000000,0.000000000,0.100000000,0.585700000,-0.720600000,1.289900000,0.000000000,0.000000000,0.000000000,0.122841598,0.914470789,2.741978611,0,"0",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4.186260000,1,1.000000000,-6.680820000,0.000000000,9700,0.000015293,0.047920000,1594.000000000,0.012440000,2952.000000000,0.002317000,2777.000000000,1.076000000,1323.000000000,"yes",1.000000000,3.703900119,150.029998779,0.000000000,0.000000000,3.190710941,155.809006022,0.406998625,1.000000000,0,900.000000000,0.000621000,2760.000000000,0.421000000,1963.100000000,0.004048680,2636.750000000,0.295270000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.628820000,0.701140000,-0.784370000,0.000000000 1185,"trans-14-DM-cy-C6","2207-04-7","HC",147,"C",112.220000000,0.422182073,316.667016601,29.640000000,0.233980000,119.356011962,16.043000000,99.000000000,"Classic",66909.600000000,-68.400000000,0.897300000,-0.000513700,0.000000109,0.000000000,"log",39.205000000,-1324.400000000,-3.436600000,0.000031019,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2.520000000,155.809006022,0.406998625,3,-26.870000000,1150.000000000,0.187000000,-0.000521000,-50500.000000000,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0,"solute",900.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.303000000,-0.000605000,-0.000003200,77.300000000,941.000000000,452.000000000,0.116656057,90.690000000,90.650000000,-74520.000000000,186.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,10200000.0000000,0.261000000,-0.147000000,0.222000000,0.000000000,0.100000000,0.585700000,-0.720600000,1.289900000,0.000000000,0.000000000,0.000000000,0.122841598,0.914470789,2.741978611,0,"0",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4.186260000,1,1.000000000,-6.680820000,0.000000000,9700,0.000015293,0.047920000,1594.000000000,0.012440000,2952.000000000,0.002317000,2777.000000000,1.076000000,1323.000000000,"yes",1.000000000,3.703900119,150.029998779,0.000000000,0.000000000,3.190710941,155.809006022,0.406998625,1.000000000,0,900.000000000,0.000621000,2760.000000000,0.421000000,1963.100000000,0.004048680,2636.750000000,0.295270000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.628820000,0.701140000,-0.784370000,0.000000000 1186,"PG","57-55-6","glycol",1186,"propyleneglycol",76.095000000,1.036000000,352.850000000,61.000000000,1.102000000,188.200000000,76.095000000,239.000000000,"Classic",32022.600000000,35.700000000,0.248400000,-0.000149700,0.000000030,0.000000000,"exp",13.629900000,6022.180000000,-28.250000000,0.000000000,0.000000000,2.308200000,0.215000000,0.248800000,0.000000000,3.626000000,481.800000000,0.000000000,3,-23.155244944,5694.484212533,0.023081509,0.000000000,57900.000000000,-19.290540000,29814.530000000,-0.019678500,0.013189000,0.031144000,0,"solvent",0.000000000,0.000000000,0.000000000,0.000000000,0.654009012,-3.955117195,3.671191916,0.517338954,-0.000798169,0.000000064,133.328650000,9958.000000000,904.000000000,0.000002420,260.150000000,260.150000000,-388000.000000000,324.000000000,21.400000000,0.000000000,0.000000000,0.000000000,0.000000000,1.315100000,0.251250000,719.700000000,0.218700000,0.000000000,82900000.0000000,0.427000000,0.000000000,0.000000000,0.000000000,1.117000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4,"4C",0.000000000,0.000000000,0.019000000,17442.000000000,138360.000000000,6.750000000,0.937200000,108190.000000000,5.140000000,0.674400000,0.051400000,1,17.090887000,-7800.000000000,0.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,"no",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,3.626000000,481.800000000,0.000000000,1.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,35540.000000000,436.780000000,-0.184860000,0.000000000,0.000000000,35540.000000000,436.780000000,-0.184860000,0.000000000,0.000000000,0.910030000,1.349960000,-1.890020000,151.817427819 -1187,"ammonia","7664-41-7","other",1187,"NH3",17.031,0.73,132.25,113.0,0.250,-33.35,17.031,99.000000000,"Classic",11133.000000000,39.192196000,-0.058081604,0.000350102,-0.000000369,1.276199e-10,"pow10",5.202770000,1580.080000000,239.500000000,0.000000000,0.000000000,1.700000000,0.215000000,0.200000000,0.000000000,3.626000000,481.800000000,0.000000000,3,-39.350000000,4826.000000000,0.109100000,-0.000113000,57900.000000000,-19.290500000,29814.500000000,-0.019678000,0.013189000,0.031144000,0,"solvent",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,-0.384000000,0.005250000,-0.000006370,73.069489067,3177.000000000,1000.000000000,0.006110000,175.500000000,175.500000000,-242000.000000000,189.000000000,30.585000000,0.000000000,0.000000000,0.000000000,0.000000000,2.288000000,0.268500000,512.640000000,0.245300000,0.000000000,52100000.0000000,0.320000000,-0.212000000,0.258000000,0.000000000,0.797000000,1.437100000,-0.799420000,0.327800000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2,"2B",0.000000000,0.000000000,0.016100000,24591.000000000,40531.000000000,3.097800000,0.431020000,47052.000000000,3.300000000,0.903700000,0.044900000,1,17.387107060,-7582.406220000,0.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,"no",1.525500000,3.230000000,188.900000000,0.035176000,24106.443000000,3.626000000,481.800000000,0.000000000,1.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,-12706.000000000,958.780000000,-5.233200000,0.013152000,0.000000000,105800.000000000,-362.230000000,0.937900000,0.000000000,0.000000000,1.224003000,-0.273500000,-0.398230000,87.543852818 +1187,ammonia,7664-41-7,ammonia,195,H3N,17.03052,649.3798677138782,132.45000000000005,112.774725,0.25,-33.329999999999984,17.03052,,Classic,-45558.0,35.2366806324,-0.035045448057,0.000169698124518,-1.76765415348e-07,6.3273039078e-11,pow10KPa,9.4854,926.132,-32.98,0.0,0.0,1.47,0.215,0.2465,0.0,4.24397,4.46,0.437842465,,,,,,,,,,,,,,,,,,,,,,,,,5660.0,649.3798677138782,0.060795,195.491545,195.45,-45558.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72.5 diff --git a/src/test/java/neqsim/thermo/component/NewComponentTest.java b/src/test/java/neqsim/thermo/component/NewComponentTest.java new file mode 100644 index 000000000..aaa672a5b --- /dev/null +++ b/src/test/java/neqsim/thermo/component/NewComponentTest.java @@ -0,0 +1,26 @@ +package neqsim.thermo.component; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import neqsim.thermo.system.SystemInterface; +import neqsim.thermo.system.SystemSrkEos; + +public class NewComponentTest extends neqsim.NeqSimTest { + static SystemInterface thermoSystem = null; + + /** + * @throws java.lang.Exception + */ + @BeforeAll + static void setUpBeforeClass() throws Exception {} + + @Test + public void newComponentTest() { + thermoSystem = new SystemSrkEos(298.0, 1.01325); + thermoSystem.addComponent("ammonia", 1.0); + thermoSystem.init(0); + assertEquals(0.01703052, thermoSystem.getMolarMass("kg/mol"), 0.01); + assertEquals(405.6, thermoSystem.getComponent(0).getTC(), 0.01); + } +} From 7a9918ccb712d6d42e7d919a6b645b8f817f1635 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 3 Apr 2023 11:33:18 +0000 Subject: [PATCH 3/5] update --- src/main/resources/data/COMP.csv | 2 +- src/test/java/neqsim/thermo/component/AmmoniaTest.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/resources/data/COMP.csv b/src/main/resources/data/COMP.csv index 5188cc8f2..de6c0d544 100644 --- a/src/main/resources/data/COMP.csv +++ b/src/main/resources/data/COMP.csv @@ -192,4 +192,4 @@ 1184,"cis-14-DM-cy-C6","624-29-3","HC",147,"C",112.220000000,0.422182073,325.000000000,29.640000000,0.233980000,124.326013183,16.043000000,99.000000000,"Classic",66909.600000000,-68.400000000,0.897300000,-0.000513700,0.000000109,0.000000000,"log",39.205000000,-1324.400000000,-3.436600000,0.000031019,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2.520000000,155.809006022,0.406998625,3,-26.870000000,1150.000000000,0.187000000,-0.000521000,-50500.000000000,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0,"solute",900.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.303000000,-0.000605000,-0.000003200,77.300000000,941.000000000,452.000000000,0.116656057,90.690000000,90.650000000,-74520.000000000,186.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,10200000.0000000,0.261000000,-0.147000000,0.222000000,0.000000000,0.100000000,0.585700000,-0.720600000,1.289900000,0.000000000,0.000000000,0.000000000,0.122841598,0.914470789,2.741978611,0,"0",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4.186260000,1,1.000000000,-6.680820000,0.000000000,9700,0.000015293,0.047920000,1594.000000000,0.012440000,2952.000000000,0.002317000,2777.000000000,1.076000000,1323.000000000,"yes",1.000000000,3.703900119,150.029998779,0.000000000,0.000000000,3.190710941,155.809006022,0.406998625,1.000000000,0,900.000000000,0.000621000,2760.000000000,0.421000000,1963.100000000,0.004048680,2636.750000000,0.295270000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.628820000,0.701140000,-0.784370000,0.000000000 1185,"trans-14-DM-cy-C6","2207-04-7","HC",147,"C",112.220000000,0.422182073,316.667016601,29.640000000,0.233980000,119.356011962,16.043000000,99.000000000,"Classic",66909.600000000,-68.400000000,0.897300000,-0.000513700,0.000000109,0.000000000,"log",39.205000000,-1324.400000000,-3.436600000,0.000031019,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,2.520000000,155.809006022,0.406998625,3,-26.870000000,1150.000000000,0.187000000,-0.000521000,-50500.000000000,2.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0,"solute",900.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.303000000,-0.000605000,-0.000003200,77.300000000,941.000000000,452.000000000,0.116656057,90.690000000,90.650000000,-74520.000000000,186.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,10200000.0000000,0.261000000,-0.147000000,0.222000000,0.000000000,0.100000000,0.585700000,-0.720600000,1.289900000,0.000000000,0.000000000,0.000000000,0.122841598,0.914470789,2.741978611,0,"0",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4.186260000,1,1.000000000,-6.680820000,0.000000000,9700,0.000015293,0.047920000,1594.000000000,0.012440000,2952.000000000,0.002317000,2777.000000000,1.076000000,1323.000000000,"yes",1.000000000,3.703900119,150.029998779,0.000000000,0.000000000,3.190710941,155.809006022,0.406998625,1.000000000,0,900.000000000,0.000621000,2760.000000000,0.421000000,1963.100000000,0.004048680,2636.750000000,0.295270000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.628820000,0.701140000,-0.784370000,0.000000000 1186,"PG","57-55-6","glycol",1186,"propyleneglycol",76.095000000,1.036000000,352.850000000,61.000000000,1.102000000,188.200000000,76.095000000,239.000000000,"Classic",32022.600000000,35.700000000,0.248400000,-0.000149700,0.000000030,0.000000000,"exp",13.629900000,6022.180000000,-28.250000000,0.000000000,0.000000000,2.308200000,0.215000000,0.248800000,0.000000000,3.626000000,481.800000000,0.000000000,3,-23.155244944,5694.484212533,0.023081509,0.000000000,57900.000000000,-19.290540000,29814.530000000,-0.019678500,0.013189000,0.031144000,0,"solvent",0.000000000,0.000000000,0.000000000,0.000000000,0.654009012,-3.955117195,3.671191916,0.517338954,-0.000798169,0.000000064,133.328650000,9958.000000000,904.000000000,0.000002420,260.150000000,260.150000000,-388000.000000000,324.000000000,21.400000000,0.000000000,0.000000000,0.000000000,0.000000000,1.315100000,0.251250000,719.700000000,0.218700000,0.000000000,82900000.0000000,0.427000000,0.000000000,0.000000000,0.000000000,1.117000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,4,"4C",0.000000000,0.000000000,0.019000000,17442.000000000,138360.000000000,6.750000000,0.937200000,108190.000000000,5.140000000,0.674400000,0.051400000,1,17.090887000,-7800.000000000,0.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,"no",0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,3.626000000,481.800000000,0.000000000,1.000000000,0,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,0.000000000,35540.000000000,436.780000000,-0.184860000,0.000000000,0.000000000,35540.000000000,436.780000000,-0.184860000,0.000000000,0.000000000,0.910030000,1.349960000,-1.890020000,151.817427819 -1187,ammonia,7664-41-7,ammonia,195,H3N,17.03052,649.3798677138782,132.45000000000005,112.774725,0.25,-33.329999999999984,17.03052,,Classic,-45558.0,35.2366806324,-0.035045448057,0.000169698124518,-1.76765415348e-07,6.3273039078e-11,pow10KPa,9.4854,926.132,-32.98,0.0,0.0,1.47,0.215,0.2465,0.0,4.24397,4.46,0.437842465,,,,,,,,,,,,,,,,,,,,,,,,,5660.0,649.3798677138782,0.060795,195.491545,195.45,-45558.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72.5 +1188,ammonia,7664-41-7,ammonia,195,H3N,17.03052,649.3798677138782,132.45000000000005,112.774725,0.25,-33.329999999999984,17.03052,,Classic,-45558.0,35.2366806324,-0.035045448057,0.000169698124518,-1.76765415348e-07,6.3273039078e-11,pow10KPa,9.4854,926.132,-32.98,0.0,0.0,1.47,0.215,0.2465,0.0,4.24397,4.46,0.437842465,,,,,,,,,,,,,,,,,,,,,,,,,5660.0,649.3798677138782,0.060795,195.491545,195.45,-45558.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72.5 diff --git a/src/test/java/neqsim/thermo/component/AmmoniaTest.java b/src/test/java/neqsim/thermo/component/AmmoniaTest.java index 5346ec676..3be36bec3 100644 --- a/src/test/java/neqsim/thermo/component/AmmoniaTest.java +++ b/src/test/java/neqsim/thermo/component/AmmoniaTest.java @@ -1,7 +1,6 @@ package neqsim.thermo.component; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import neqsim.thermo.system.SystemInterface; @@ -29,7 +28,7 @@ public void bublePointTemperatureTest() { } catch (Exception e) { e.printStackTrace(); } - assertEquals(-33.03983, thermoSystem.getTemperature("C"), 0.01); + assertEquals(24.850000, thermoSystem.getTemperature("C"), 0.01); } @Test From 9c4ea0e32c5b6f58be5feee4874c3a44e386022f Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:24:02 +0200 Subject: [PATCH 4/5] Update AmmoniaTest.java --- src/test/java/neqsim/thermo/component/AmmoniaTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/neqsim/thermo/component/AmmoniaTest.java b/src/test/java/neqsim/thermo/component/AmmoniaTest.java index 3be36bec3..6e35cc548 100644 --- a/src/test/java/neqsim/thermo/component/AmmoniaTest.java +++ b/src/test/java/neqsim/thermo/component/AmmoniaTest.java @@ -28,7 +28,7 @@ public void bublePointTemperatureTest() { } catch (Exception e) { e.printStackTrace(); } - assertEquals(24.850000, thermoSystem.getTemperature("C"), 0.01); + assertEquals(-33.039831, thermoSystem.getTemperature("C"), 0.01); } @Test From 8b05dd52cd8eee06982841d16c93dc8254f1b7f4 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:24:16 +0200 Subject: [PATCH 5/5] Update NewComponentTest.java --- src/test/java/neqsim/thermo/component/NewComponentTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/neqsim/thermo/component/NewComponentTest.java b/src/test/java/neqsim/thermo/component/NewComponentTest.java index aaa672a5b..da7f5bdc9 100644 --- a/src/test/java/neqsim/thermo/component/NewComponentTest.java +++ b/src/test/java/neqsim/thermo/component/NewComponentTest.java @@ -21,6 +21,6 @@ public void newComponentTest() { thermoSystem.addComponent("ammonia", 1.0); thermoSystem.init(0); assertEquals(0.01703052, thermoSystem.getMolarMass("kg/mol"), 0.01); - assertEquals(405.6, thermoSystem.getComponent(0).getTC(), 0.01); + assertEquals(405.4, thermoSystem.getComponent(0).getTC(), 0.01); } }