# This file is used to hold global variables that are used by more than one file of the program. # Instead of always passing all variables to functions, this file can simply be imported to get them. import numpy as np # Main Tkinter application object will be stored here (class HelmholtzGUI) app = None # The main access point for all hardware commands CAGE_DEVICE = None # Magnetometer proxy object providing access to mag. data from an external client per tcp interface MAGNETOMETER = None # list with the names of each axis, used mainly for printing functions AXIS_NAMES = ["X-Axis", "Y-Axis", "Z-Axis"] global XY_PORT # serial port for XY PSU will be stored here (string) global Z_PORT # serial port for Z PSU will be stored here (string) global PORTS # list containing [XY_PORT, XY_PORT, Z_PORT], used in loops where info on each axis is needed global threadLock # thread locking object, used to force threads to perform actions in a certain order (threading.Lock) exitFlag = True # False when main window is open, True otherwise # Create dictionaries with default Constants and maximum/minimum values # Used to create default configs and to check if user inputs are within safe limits # ToDo: refine values after testing # ToDo: put this into a config file # Dictionary for numerical values: # format: key: [default values], [maximum values], [minimum values] default_arrays = { "coil_const": np.array([[38.957, 40.408, 37.754], [50, 50, 50], [0, 0, 0]]) * 1e-6, # Coil constants [x,y,z] [T/A] "ambient_field": np.array([[0, 0, 0], [200, 200, 200], [-200, -200, -200]]) * 1e-6, # ambient magnetic field [T] "resistance": np.array([[3.131, 3.107, 3.129], [5, 5, 5], [1, 1, 1]], dtype=float), # resistance of circuits [Ohm] "max_volts": np.array([[15, 15, 15], [16, 16, 16], [0, 0, 0]], dtype=float), # max. voltage, limited to 16V by used diodes! [V] "max_amps": np.array([[5, 5, 5], [6, 6, 6], [0, 0, 0]], dtype=float), # max. allowed current (A) "relay_pin": [[15, 16, 17], [15, 16, 17], [15, 16, 17]] # pins on the arduino for reversing [x,y,z] polarity } # Dictionary for PSU configuration: default_psu_config = { "supply_model": "ps2000b", "xy_port": "COM", # Default serial port where PSU for X- and Y-Axes is connected "z_port": "COM", # Default serial port where PSU for Z-Axis is connected } # Configuration for socket interface SOCKET_PORT = 6677 SOCKET_MAX_CONNECTIONS = 5