Online course and simulator for engineering thermodynamics

Use and design of external classes

Note

This page is an introduction to the mechanism of external classes of Thermoptim , which allows one to extend the software features.

The mechanism of external classes

One great advantage of Thermoptim is that its graphic environment can be used to visually build models for a large number of energy systems, from the simplest refrigerator to complex integrated gasification combined cycle electric power plants using several hundred elements.

Not only does this greatly simplify the modeling process and facilitate subsequent use and maintenance of the model, but it also makes the models more reliable. The connections between the different elements are made automatically, thus ensuring consistency.

Until version 1.4, only the components available in Thermoptim primitive type set could be assembled in this manner, which limited the potential of the software. A number of users wished to be able to define their own elements and/or their own substances.

Thermoptim interface with external classes (Java code elements) provides the solution and facilitates the interoperability of the software with the outside world, especially with other applications developed in Java.

The benefits are two-fold:

  • create Thermoptim extensions from the common primitive type set, by adding external modules that define the elements that automatically appear on the screens in a seamless fashion. Thus users can add their own substances or components not available in the basic set;

  • drive Thermoptim from another application, either to guide a user (smart tutorial) or to check the code (driver or regulation, off-design simulation , access to thermodynamic libraries).

Practically speaking, adding a new external process is quite easy. Simply create a specific class, which inherits from the abstract parent class extThopt.ExtProcess. The interaction with Thermoptim is ensured on two levels:

  • by general methods for performing the required calculations;

  • by a JPanel that is built into the external process screen. Thus, the class designer can create his own graphic interface, which is then inserted into the Thermoptim screen.

The mechanism of external classes also allows to link Thermoptim to thermodynamic property servers (TPS) in order to provide access to models not available in the fluid core, including mixtures of vapors.

Using external classes

The use of already developed external classes is very simple: just add these classes to Thermoptim libraries, placing them in an archive named extUser.zip for version 1.5 and extUser2.zip for version 2.5. The only constraint is that the structure of the archive must comply with a well-defined format.

These classes call upon some libraries contained in another archive called extThopt.zip for version 1.5 and extThopt2.zip for version 2.5. You must also ensure that the version of this package is compatible with the classes used. Please find below the extThopt.zip and extThopt2.zip versions valid for versions 1.5 and 2.5.

Specifically, the external classes are divided between the two extUser2.zip and extThopt2.zip files. The first usually contains the user-defined classes, and the second the generic classes that ensure communication with the Thermoptim core.

The extThopt.zip and extThopt2.zip files valid for different versions of Thermoptim are available from this page.

From version 2.51, the external class manager can integrate external classes in the library extUser2.zip. It is accessible from the Special menu of the simulator. Otherwise, the easiest way is to use a standard compactor as described in Volume 3 of the Thermoptim reference manual .

The Thermoptim model library offers five categories of external classes:

  • External substances

  • External processes

  • External dividers

  • External mixers

  • Drivers

Volume 3 of the Thermoptim reference manual will explain how to use and design external classes and Diapason session S07En_ext will guide you through your first steps.

Archive containing all models

Historically, external classes began to be developed for Thermoptim versions 1.3 to 1.5, then, from 2012, Thermoptim versions 2.51, 2.61, 2.71 and 2.81 were developed, as some operating systems, such as MacOS, no longer allowed us to run versions 1.3 to 1.5.

A few years later, from October 2018, a change in the Java libraries forced us to modify the source code of external classes and Thermoptim, leading to versions 2.52, 2.62, 2.72 and 2.82.

Three versions of the external classes may therefore be used, depending on the version of Thermoptim you have. If you do not know it, it is indicated in the screen that appears when you click on the line "About Thermoptim" in the "Help" menu of the simulator.

The need to develop the external classes corresponding to versions 2.52 and later resulted in multiple versions of the extUser2.zip and extThopt2 files.zip corresponding to each model.

To simplify things, we have gathered all the available models (except those requiring special libraries like CTPLib ou IF97) in the extUser2.zip files of the archives below, for the four versions 2.51 and 2.61, 2.52 and 2.62, 2.71 and 2.81, as well as 2.72 and 2.82. The files offered for download for each model will provide you with additional documentation and examples.

As each extUser2.zip file must be used with the corresponding version of the extThopt2.zip file, the download links below give access to an archive containing both files.

Download the archive corresponding to your needs, extract the two files extUser2.zip and extThopt2.zip, and place them in the Thermoptim installation directory, after taking the precaution of creating a backup of the initial directory so that you can return to it in case of difficulty.

2.51.zip

2.52.zip

2.81.zip

2.82.zip

Creation of new external classes

Without being very difficult, the creation of new external classes requires a minimum of Java programming skills. The examples presented in Volume 3 of the reference manual will help you get started with this exercise, and a development environment for external classes is offered below.

Specific explanations on the use of external classes to calculate the properties of moist mixtures are also available.

Development environment for external classes (versions 2.5 and above)

To develop the external classes, if you do not already have a Java development environment, you can use an open source tool called Eclipse, that you can download for free from the Internet.

Eclipse allows you to write your classes in Java, compile them and directly test their integration into Thermoptim.

A page of this portal explaining how to install and configure this environment has been prepared for your consideration.

Of course, you can also configure Eclipse to develop external classes for version 1.5 of Thermoptim, but we recommend working with version 2.5 and later.

Creation of external drivers

The technological design of components requires to refine the phenomenological models used in the Thermoptim core, supplemented appropriately.

The implementations of these new Thermoptim features are mostly made in the form of external classes, which provides great flexibility for users to customize them.

The classic phenomenological Thermoptim version remains unchanged: it is supplemented by a software layer to take into account the technological design and off-design models.

Technological design classes (versions 2.7 and 2.8) are complementary to those of the core allowing the consideration of the equations specific to technological choices made, such as calculating the heat transfer coefficient U of a heat exchanger, or the flow-rate and isentropic efficiency a compressor.

The driver is responsible for the systemic coordination of calculations of the various components put into play. It looks for a matching set of variables consistent with the physical and technological problems posed, and is used to change the setting of the Thermoptim project.

You will find all the details of these new developments in Volume 4 of the reference manual of the software, and concrete examples in the Methodological guides section.

copyright R. Gicquel v2024.2

Created with Scenari (new window)