-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotor issue long term test.py
74 lines (58 loc) · 1.88 KB
/
motor issue long term test.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
'''
This project simulate random supply temprature to long term test
'''
#Import Library
import csv
#from typing import ClassVar
from BACBase import *
# from ede357 import *
import random
# from basic_service import *
#Project start
# def changetemp(obj, var):
# bacWrite(obj,var)
# time.sleep(20)
# motorval = bacRead(RotHExgSpd)
# motorcur = bacRead(RotHExgCur)
# now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
# restxt = 'TSu is : ' + str(var) + ' ' + 'Motor Speed is :' + ' ' + str(motorval)+' '+'Motor Current is '+str(motorcur)
# rescsv = [str(now), str(motorval), str(motorcur)]
# print(restxt)
# return rescsv
# def write_csv(row):
# f = open('inputfile/MotorMonitor.csv', 'a')
# f.write('\xEF\xBB\xBF')
# writer = csv.writer(f)
# writer.writerow(row)
if __name__ == '__main__':
# bacWrite(RotHExgSpd,0)
# time.sleep(5)
# bacWrite(RotHExgSpd,1)
# now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
# print(now)
# i = 0
# for i in range(1, 14400000, 1):
# motorcur = bacRead(RotHExgCur)
# if motorcur !=0:
# break
# now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
# print(now)
# LTdevice_ip = '192.168.50.100' + " "
# RotHExgSpdNH = LTdevice_ip + 'analogOutput 0'
i=0
while True:
# warmstart("192.168.1.102", "")
i=i+1
print("LoopIndex:" + str(i))
# bacWrite(RotHExgSpd,3)
bacWrite(RotHExgSpd,3)
time.sleep(90)
RotCur = bacRead(RotHExgCur)
print("CoilCurrent" + str(RotCur))
if RotCur == 0:
now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
print(now)
break
else:
bacWrite(RotHExgSpd,0)
time.sleep(30)