forked from zietzm/Helmholtz_Test_Bench
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
import numpy as np
|
|
import globals as g
|
|
import cage_func as func
|
|
# from pyps2000b import PS2000B
|
|
from Arduino import Arduino
|
|
|
|
# User Inputs/Configuration----------------------------------
|
|
# Desired output:
|
|
mag_vec1 = np.array([10, 10, 5])*1e-6
|
|
|
|
# Constants:
|
|
g.Coil_const = np.array([38.6, 38.45, 37.9])*1e-9 # Coil constants [x,y,z] in T/A
|
|
g.ambientField = np.array([80])*1e-6 # ambient magnetic field in measurement area, to be cancelled out
|
|
g.resistances = np.array([3.9, 1, 1]) # resistance of [x,y,z] circuits
|
|
g.maxWatts = np.array([8, 0, 0]) # max. allowed power for [x,y,z] circuits
|
|
|
|
# COM-Ports for power supply units:
|
|
g.xyPort = "COM1" # placeholders
|
|
g.zPort = "COM1"
|
|
|
|
# Code starts here------------------------------------------
|
|
g.maxAmps = np.sqrt(g.maxWatts/g.resistances) # calculate maximum currents in each axis
|
|
|
|
print("Connecting to PSUs...")
|
|
func.set_devices() # initiate communication, set handles
|
|
print("Connecting to Arduino...")
|
|
g.arduino = Arduino() # search for connected arduino and set handle
|
|
print("Arduino found.")
|
|
print("Activating PSU outputs...")
|
|
func.activate_all() # activate remote control and outputs on PSUs
|
|
|
|
func.set_field_simple(mag_vec1)
|
|
|
|
func.deactivate_all()
|