Skip to content

The NeqSim parameter database

Sviatoslav Eroshkin edited this page Jul 22, 2022 · 51 revisions

NeqSim reads the model parameters (such as Tc, Pc, acentric factor, kij, etc.) from a SQL database via a JDBC connection.

A Java Derby database is embedded in the source code distribution, and is the default parameter database used by NeqSim. The acess to the parameter database is controlled via the NeqSimDatabase class.

A new parameter databases can be used by inserting required tables, and setting the JDBC connection in the NeqSimDatabase.class. A simple way to create a new parameter database used by NeqSim is:

  1. Create a new paramter database using the SQL script (creates a copy of the embedded Derby database and populates it with the default parameters)

  2. Modify the connection string in the [NeqSimDatabase class], eg.(https://github.com/equinor/neqsimsource/blob/master/src/main/java/neqsim/util/database/NeqSimDataBase.java):

neqsim.util.database.NeqSimDataBase.setDataBaseType("mySQL"); neqsim.util.database.NeqSimDataBase.setConnectionString("jdbc:mysql://tr-w33:3306/neqsimthermodatabase");

The database contains all parameters needed for doing simulations with NeqSim database. Examples of tables in the database are the COMP table with the pure component parameters (TC, PC, acentric factor) and the INTER table with binary interaction coefficients (kij).

The NeqSim database parameter can be viewed or edited in a jdbc database viewer. The databases editor in the Eclipse IDE is typically set to view or edit the NeqSim database (the database must be extracted from the NeqSim jar library to the local disk before editing). To access the embedded database: user/pass remote/remote.

Viewing and editing parameters in Eclipse

Pure component names in embedded neqsim database: https://github.com/equinor/neqsim/blob/master/src/main/resources/neqsim_component_names.txt

Using a MySql database

Include MySql library on classpath by adding the dependency in the pom.xml.

		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.27</version>
		</dependency>

Using a MS Access database

Add the following dependencies in the pom.xml.

                <dependency>
			<groupId>org.ojalgo</groupId>
			<artifactId>ojalgo</artifactId>
			<version>48.4.2</version>
		</dependency>
		<dependency>
			<groupId>org.xerial</groupId>
			<artifactId>sqlite-jdbc</artifactId>
			<version>3.34.0</version>
		</dependency>
		<dependency>
			<groupId>net.sf.ucanaccess</groupId>
			<artifactId>ucanaccess</artifactId>
			<version>5.0.1</version>
		</dependency>

Add the following to the NeqSimDataBase.java for the correct path to the database.

static String dataBaseType = "MSAccessUCanAccess";
  public static String connectionString =
      "jdbc:ucanaccess:///workspaces/neqsim/NewDataBase/NeqSimDatabase.mdb;memory=true";
Clone this wiki locally