-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.py
114 lines (92 loc) · 4.9 KB
/
init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
########################################################################################################
# Script identification :: init Script ##
# This file makes all the initialization needed for the python environment to work properly. ##
# This file contains addresses and defines compatible to each user, when the selection of the user is ##
# taking place in the test file, by declarating the USER_NAME variable. ##
# Author : Bar Kristal ##
# Start Date : 18/12/16 ##
########################################################################################################
### standard modules:
#####################
import sys
import serial # for the RS232 function
import time # for the time and sleep command
import datetime # for revived the windows time signature
import binascii # for convert from UART answer to bin
import os # for the make dir option
import shlex
import shutil
import winsound # for running audio files
import socket # for tcp/ip connection with Termotron
import ctypes # module for C data types
import enum # module for C data types
import subprocess # module to create an additional process
import psutil
import visa # for controlling GPIB devices. (this module takes long time to load, so load it only if necessary)
import openpyxl # Excel library. (this module takes long time to load, so load it only if necessary)
import decimal
import platform # for the Laurebach initialization
# import PyTektronixScope
# import saleae
############################################################################################
##### defines:
#############
if USER_NAME == "Bar":
execfile(r"C:\Users\bar.kristal\Documents\GitHub\Python\devices.py")
execfile(r"C:\Users\bar.kristal\Documents\GitHub\Python\utilities.py")
execfile(r"C:\Users\bar.kristal\Documents\GitHub\Python\lab_equipment.py")
# execfile(r"C:\Users\bar.kristal\Documents\GitHub\Python\apx525_module.py")
POWER_SUPLLY_ADDRESS = "GPIB0::29::INSTR"
DMM_ADDRESS = "GPIB0::22::INSTR"
FREQUENCY_COUNTER_ADDRESS = "GPIB0::27::INSTR"
WAVE_GENERATOR_ADDRESS = "GPIB0::1::INSTR"
ELECTRONIC_LOAD_ADDRESS = "GPIB0::3::INSTR"
SCOPE_ADDRESS = "GPIB0::9::INSTR"
OVEN_ADDRESS = 'COM17'
elif USER_NAME == "Sas":
execfile(r"C:\GitHub\Python\devices.py")
execfile(r"C:\GitHub\Python\utilities.py")
execfile(r"C:\GitHub\Python\lab_equipment.py")
POWER_SUPLLY_ADDRESS = "GPIB1::29::INSTR"
DMM_ADDRESS = "GPIB0::22::INSTR"
FREQUENCY_COUNTER_ADDRESS = "GPIB0::27::INSTR"
WAVE_GENERATOR_ADDRESS = "GPIB0::1::INSTR"
ELECTRONIC_LOAD_ADDRESS = "GPIB0::3::INSTR"
SCOPE_ADDRESS = "GPIB0::9::INSTR"
TERMOTRON_TCP_IP = ("172.19.5.237" ,8080) # (ip, port) , (Sas)
elif USER_NAME == "Bisset":
execfile(r"C:\GitHub\Python\devices.py")
execfile(r"C:\GitHub\Python\utilities.py")
execfile(r"C:\GitHub\Python\lab_equipment.py")
POWER_SUPLLY_ADDRESS = "GPIB1::29::INSTR"
DMM_ADDRESS = "GPIB0::22::INSTR"
FREQUENCY_COUNTER_ADDRESS = "GPIB0::27::INSTR"
WAVE_GENERATOR_ADDRESS = "GPIB0::1::INSTR"
ELECTRONIC_LOAD_ADDRESS = "GPIB0::3::INSTR"
SCOPE_ADDRESS = "GPIB0::9::INSTR"
TERMOTRON_TCP_IP = ("172.19.5.239", 8080) # (ip, port) , (Bisset)
elif USER_NAME == "Ronny":
execfile(r"C:\Users\ronnyi\Documents\GitHub\Python\devices.py")
execfile(r"C:\Users\ronnyi\Documents\GitHub\Python\utilities.py")
execfile(r"C:\Users\ronnyi\Documents\GitHub\Python\lab_equipment.py")
# POWER_SUPLLY_ADDRESS = "GPIB1::29::INSTR"
# DMM_ADDRESS = "GPIB0::22::INSTR"
# FREQUENCY_COUNTER_ADDRESS = "GPIB0::27::INSTR"
# WAVE_GENERATOR_ADDRESS = "GPIB0::1::INSTR"
# ELECTRONIC_LOAD_ADDRESS = "GPIB0::3::INSTR"
# SCOPE_ADDRESS = "GPIB0::9::INSTR"
TERMOTRON_TCP_IP = ("172.19.5.240", 8080) # (ip, port) , (Ronny)
##########################################################################################
##### Log:
'''This section is uniform for all users.
This section creates the log files for every test,
when the test name and folder name are declared in the test itself.'''
FOLDER_DATE = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d')
DIR_NAME = os.path.join(FOLDER_PATH , 'Log' , FOLDER_DATE)
TEST_DATE = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d')
TEST_TIME = datetime.datetime.strftime(datetime.datetime.now(), '%H-%M-%S')
LOG_NAME = TEST_NAME + r"_" + TEST_DATE + r"_" + TEST_TIME + r".txt"
LOG_NAME_EXCEL = TEST_NAME + r"_" + TEST_DATE + r"_" + TEST_TIME + r".xlsx"
#open a new log:
open_log(DIR_NAME, LOG_NAME)
############################################################################################