forked from zietzm/Helmholtz_Test_Bench
67 lines
1.4 KiB
Python
67 lines
1.4 KiB
Python
# import platform
|
|
import time as t
|
|
import numpy as np
|
|
import globals as g
|
|
import cage_func as func
|
|
from pyps2000b import PS2000B
|
|
|
|
# User Inputs/Configuration----------------------------------
|
|
Test1 = 0
|
|
Test2 = 0
|
|
Test3 = 0
|
|
Test4 = 0
|
|
|
|
# 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:
|
|
xyPort = "COM7"
|
|
g.xyDevice = PS2000B.PS2000B(xyPort)
|
|
|
|
g.maxAmps = np.sqrt(g.maxWatts/g.resistances)
|
|
print(g.maxAmps)
|
|
|
|
|
|
def print_status():
|
|
print("Output 1:")
|
|
func.print_status(g.xAxis)
|
|
print("Output 2:")
|
|
func.print_status(g.yAxis)
|
|
|
|
|
|
g.xyDevice.enable_all()
|
|
func.set_to_zero(g.xyDevice)
|
|
print_status()
|
|
t.sleep(3)
|
|
|
|
if Test1 == 1:
|
|
g.xyDevice.voltage1 = 5
|
|
t.sleep(1)
|
|
print_status()
|
|
t.sleep(5)
|
|
func.set_to_zero(g.xyDevice)
|
|
|
|
if Test2 == 1:
|
|
g.xyDevice.current1 = 0.2
|
|
t.sleep(1)
|
|
print_status()
|
|
t.sleep(5)
|
|
func.set_to_zero(g.xyDevice)
|
|
|
|
if Test4 == 1:
|
|
func.set_axis_current(g.xyDevice, 0.2)
|
|
t.sleep(1)
|
|
print_status()
|
|
t.sleep(10)
|
|
func.set_to_zero(g.xyDevice)
|
|
t.sleep(1)
|
|
|
|
print_status()
|
|
|
|
g.xyDevice.disable_all()
|
|
|
|
print_status()
|