forked from zietzm/Helmholtz_Test_Bench
50 lines
2.4 KiB
Python
50 lines
2.4 KiB
Python
# 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
|
|
|
|
XY_DEVICE = None # XY PSU object will be stored here (class PS2000B)
|
|
Z_DEVICE = None # Z PSU object will be stored here (class PS2000B)
|
|
ARDUINO = None # Arduino object will be stored here (class ArduinoCtrl)
|
|
|
|
# Axis objects will be stored here (class Axis)
|
|
X_AXIS = None
|
|
Y_AXIS = None
|
|
Z_AXIS = None
|
|
|
|
AXES = None # list containing [X_AXIS, Y_AXIS, Z_AXIS]
|
|
|
|
app = None # Main Tkinter application object will be stored here (class HelmholtzGUI)
|
|
|
|
AXIS_NAMES = ["X-Axis", "Y-Axis", "Z-Axis"] # list with the names of each axis, used mainly for printing functions
|
|
|
|
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 serial ports:
|
|
default_ports = {
|
|
"xy_port": "COM1", # Default serial port where PSU for X- and Y-Axes is connected
|
|
"z_port": "COM2", # Default serial port where PSU for Z-Axis is connected
|
|
}
|