Esempio n. 1
0
 def test2_read_hold(self):
     '''读-保持寄存器'''
     ##连接mqtt
     # connect_mqtt()
     id = random.randrange(2, total - 1, 4)
     back = keep(id)
     back1 = back.get()
     time1 = timefor()
     print(time1, end=' ')
     print("读-保持寄存器:",back1)
Esempio n. 2
0
 def test3_input_jc(self):
     '''读-输入寄存器'''
     ##连接mqtt
     # connect_mqtt()
     id = random.randrange(3, total, 4)
     back = keep(id)
     back1 = back.get()
     time1  = timefor()
     print(time1,end=' ')
     print("读-输入寄存器:",back1)
Esempio n. 3
0
 def test5_write_coil(self):
     '''写-线圈'''
     ##连接mqtt
     # connect_mqtt()
     id = random.randrange(0, total - 3, 4)
     back = keep(id, 'write')
     back1 = back.get()
     time1 = timefor()
     print(time1, end=' ')
     print("写-线圈:",back1)
Esempio n. 4
0
 def test6_read_coil(self):
     '''读-线圈'''
     ##连接mqtt
     # connect_mqtt()
     id = random.randrange(0, total - 3, 4)
     back = keep(id)
     back1 = back.get()
     time1 = timefor()
     print(time1, end=' ')
     print("读-线圈:",back1)
Esempio n. 5
0
 def test1_write_hold(self):
     '''写-保持寄存器'''
     ##连接mqtt
     # connect_mqtt()
     id = random.randrange(2, total - 1, 4)
     back = keep(id, 'write')
     back1 = back.get()
     time1 = timefor()
     print(time1, end=' ')
     # self.assertIn('true', back1)
     print("写-保持寄存器:",back1)
Esempio n. 6
0
 def test4_ls_input(self):
     '''读-离散输入'''
     ##连接mqtt
     # connect_mqtt()
     id = random.randrange(1, total-2, 4)
     back = keep(id)
     back1 = back.get()
     time1 = timefor()
     print(time1, end=' ')
     # self.assertIn('0', back1)
     print("读-离散输入:",back1)