Skip to main content

Tools for launching EES calculation and retrieving results from python

Project description

EES connector

EES connector is a tools developed by the SERG research group of the University of Florence for launching EES calculation and retrieving results from python.

The beta version can be downloaded using PIP:

pip install EES_connector

Once the installation has been completed the user can import the tool and initialize the connector itself.

from EESConnect import EESConnector

with EESConnector() as ees:

    # insert your code here

Two important aspects to keep in mind for the initialization:

  • Please use the with statement during the initialization as shown above

  • A file-dialog will appear the first time that the connector is imported asking the user to select the EES executable path (usually it's "C:\EES32\ees.exe"). Once the executable path has been selected, the program keep it in memory in order to avoid new appearance of the file-dialog. The stored executable can be modified calling the following function:

from EESConnect import EESConnector

EESConnector.modify_ees_executable_path()

Finally, you can ask the program to launch EES calculation using the following command:
from EESConnect import EESConnector
from tkinter import filedialog
import tkinter as tk

#select the ees file path
root = tk.Tk()
root.withdraw()
ees_file_path = filedialog.askopenfilename()

with EESConnector() as ees:
    
    ees.ees_file_path = ees_file_path
    result = ees.calculate(["air_ha", 110, 1013.25])
    print(result[1])

Multiple call are possible passing a dictionaty in the ees.calculate() function in order to speed up the calculation process (the program is loaded on the RAM only once):

from EESConnect import EESConnector
from tkinter import filedialog
import tkinter as tk

#select the ees file path
root = tk.Tk()
root.withdraw()
ees_file_path = filedialog.askopenfilename()

with EESConnector() as ees:
    
    ees.ees_file_path = ees_file_path
    result = ees.calculate({

            "air_ha":   ["air_ha", 300, 1013.25],
            "R22":      ["R22", 300, 1013.25],
            "R236fa":   ["R236fa", 300, 1013.25],
            "R134a":    ["R134a", 300, 1013.25]

        })
    
    print(result["R22"][1])
    print(result["R236fa"][1])

Please notice that the EES file has to be configured properly in order to work.
Here's an example, that works with the python code described above:

$UnitSystem SI K kPa kJ 
$Import 'ees_input.dat' file$ F$ T P

h=enthalpy(F$; T=T; P=P)
s=entropy(F$; T=T; P=P)

$Export file$ h s

An explanation on how to set EES properly can be found here. Two important things had to be noted:

  • The input defined in the EES file must be consistent with the list provided to the calculation function as an input

  • The input and output file in the EES code must be called "ees_input.dat" and "ees_output.dat" respectively!



-------------------------- !!! THIS IS A BETA VERSION !!! --------------------------

please report any bug or problems in the installation to pietro.ungar@unifi.it
for further information visit: https://tinyurl.com/SERG-3ETool

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EES_connector-0.3.4.tar.gz (20.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page