forked from zietzm/Helmholtz_Test_Bench
Implemented Arduino-based polarity control into main script
This commit is contained in:
1 parent
ea3085e12b
commit
12ec34182b
5 files changed
+129
-81
No files matched your search
@@ -4,6 +4,7 @@ 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:
|
||||
@@ -12,14 +13,23 @@ 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:
|
||||
xPort = "COM1" # placeholders
|
||||
yPort = "COM3"
|
||||
zPort = "COM5"
|
||||
g.xyPort = "COM1" # placeholders
|
||||
g.zPort = "COM1"
|
||||
|
||||
func.set_devices(xPort, yPort, zPort) # initiate communication, set handles
|
||||
func.activate_all() # activate remote control and outputs
|
||||
# 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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user