removes logging, checks that load-position pairs are not [0,0]
This commit is contained in:
@@ -30,11 +30,6 @@ plc_ip = '192.168.1.10'
|
|||||||
|
|
||||||
|
|
||||||
def readTag(addr, tag):
|
def readTag(addr, tag):
|
||||||
logging.basicConfig(
|
|
||||||
filename="ClxDriver.log",
|
|
||||||
format="%(levelname)-10s %(asctime)s %(message)s",
|
|
||||||
level=logging.DEBUG
|
|
||||||
)
|
|
||||||
c = ClxDriver()
|
c = ClxDriver()
|
||||||
|
|
||||||
if c.open(addr):
|
if c.open(addr):
|
||||||
@@ -193,8 +188,14 @@ class Card():
|
|||||||
self.num_points = int(readTag(plc_ip, "Card_Past[1].Num_Points")[0])
|
self.num_points = int(readTag(plc_ip, "Card_Past[1].Num_Points")[0])
|
||||||
print("reading {} from card ID {}".format(self.num_points, self.card_id))
|
print("reading {} from card ID {}".format(self.num_points, self.card_id))
|
||||||
for i in range(0, self.num_points):
|
for i in range(0, self.num_points):
|
||||||
self.sc.append([round(float(readTag(plc_ip, 'Card_Past[1].Surface_Position[{}]'.format(i))[0]), 3), round(float(readTag(plc_ip, 'Card_Past[1].Surface_Load[{}]'.format(i))[0]), 3)])
|
surf_pos = round(float(readTag(plc_ip, 'Card_Past[1].Surface_Position[{}]'.format(i))[0]), 3)
|
||||||
self.dc.append([round(float(readTag(plc_ip, 'Card_Past[1].Downhole_Position[{}]'.format(i))[0]), 3), round(float(readTag(plc_ip, 'Card_Past[1].Downhole_Load[{}]'.format(i))[0]), 3)])
|
surf_lod = round(float(readTag(plc_ip, 'Card_Past[1].Surface_Load[{}]'.format(i))[0]), 3)
|
||||||
|
down_pos = round(float(readTag(plc_ip, 'Card_Past[1].Downhole_Position[{}]'.format(i))[0]), 3)
|
||||||
|
down_lod = round(float(readTag(plc_ip, 'Card_Past[1].Downhole_Load[{}]'.format(i))[0]), 3)
|
||||||
|
if not (surf_pos == 0.0) and not (surf_lod == 0.0):
|
||||||
|
self.sc.append([surf_pos, surf_lod])
|
||||||
|
if not (down_pos == 0.0) and not (down_lod == 0.0):
|
||||||
|
self.dc.append([, ])
|
||||||
|
|
||||||
def stringify(self):
|
def stringify(self):
|
||||||
''' returns a list of two strings [surface card, downhole card]'''
|
''' returns a list of two strings [surface card, downhole card]'''
|
||||||
@@ -203,8 +204,8 @@ class Card():
|
|||||||
for i in range(0, self.num_points):
|
for i in range(0, self.num_points):
|
||||||
sc_str = sc_str + "[{},{}],".format(self.sc[i][0], self.sc[i][1])
|
sc_str = sc_str + "[{},{}],".format(self.sc[i][0], self.sc[i][1])
|
||||||
dc_str = dc_str + "[{},{}],".format(self.dc[i][0], self.dc[i][1])
|
dc_str = dc_str + "[{},{}],".format(self.dc[i][0], self.dc[i][1])
|
||||||
sc_str = sc_str[:-1] + "]"
|
sc_str = sc_str + "[{},{}]]".format(self.sc[0][0], self.sc[0][1])
|
||||||
dc_str = dc_str[:-1] + "]"
|
dc_str = dc_str + "[{},{}]]".format(self.dc[0][0], self.dc[0][1])
|
||||||
return[sc_str, dc_str]
|
return[sc_str, dc_str]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user