Skip to main content

UNISIM connector

UNISIM connector is a tools developed by the SERG research group of the University of Florence for modifying UNISIM files from python.

The beta version can be downloaded using PIP:

pip install UNISIM_connector

Once the installation has been completed the user can import the tool and initialize the connector itself passing the path of the UNISIM file that has to be opened (in the example below the file is selected by the user trough a dialog box. If possible use a with statement for the initialization.

from UNISIMConnect import UNISIMConnector
from tkinter import filedialog
import tkinter as tk

root = tk.Tk()
root.withdraw()
unisim_path = filedialog.askopenfilename()

with UNISIMConnector(unisim_path) as unisim:

    # insert your code here

Finally, you can ask the program to modify values in the spreadsheets inside the UNISIM file and wait until a solution has been reached

with UNISIMConnector(unisim_path) as unisim:
  
    spreadsheet = unisim.get_spreadsheet("CALCULATION")
    
    spreadsheet.set_cell_value("A5", 15)
    unisim.wait_solution()
    spreadsheet.get_cell_value("A6")

If you need to keep UNISIM open once the calculation has been completed you can set the option "close_on_completion=False".

with UNISIMConnector(unisim_path, close_on_completion=False) as unisim:
  
    spreadsheet = unisim.get_spreadsheet("CALCULATION")
    
    spreadsheet.set_cell_value("A5", 15)
    unisim.wait_solution()
    spreadsheet.get_cell_value("A6")

the method "wait_solution" can be used to set a timeout after which, if UNISIM has not converged, the code continues the execution. In addition there's also the possibility to set an autoclicker to automatically close UNISIM warning that blocks the execution. The method can also check whether the execution has been stopped by a consistency error and try to restart the execution N times with N being the number passed to the function call. These last two options can unlock the iteration if it gets struck allowing for more reliable calculations, but they can also lead to inconsistent results and can significantly slow down the calculation hence use them carefully.

with UNISIMConnector(unisim_path, close_on_completion=False) as unisim:
  
    spreadsheet = unisim.get_spreadsheet("CALCULATION")
    
    spreadsheet.set_cell_value("A5", 15)
    
    # Wait solution with: 
    #   - a timeout of 10 seconds
    #   - Checking for pop_ups every 2 seconds
    #   - Trying for 3 times to restart the calculation if a consistency error arose
    unisim.wait_solution(timeout=10, check_pop_ups=2, check_consistency_error=3)
    
    spreadsheet.get_cell_value("A6")

-------------------------- !!! 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

Release files for UNISIM-connector 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for UNISIM-connector 0.2.1
File Size Uploaded
UNISIM_connector-0.2.1.tar.gz 17.5 kB Details

Release files / UNISIM_connector-0.2.1.tar.gz

Download URL UNISIM_connector-0.2.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1b4cfd061c1c09a867bd1bb65bfbf111f9871a64888cdc54db47433cbbe5aa34
BLAKE2b-256 checksum
How to use checksums
e6483d90d6ffa59ffe2df0c6e32a8be243ea3664b57e3320a1e2cec4b8f34b05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page