Skip to content

Commit 334e4c9

Browse files
author
JesseJ12345
committed
1. Modify setup.py 2. Modify var configure
1 parent 95c9d0f commit 334e4c9

File tree

11 files changed

+57
-97
lines changed

11 files changed

+57
-97
lines changed

ISO-on-TCP/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
'''
1010
from setuptools import setup, find_packages
1111
setup(name='ReplaceWithYourAppName',
12+
version='0.0.1',
1213
sdk_version='0.0.0',
13-
version='0.0.0',
14-
author='Inhand',
14+
author='InHand',
1515
author_email='',
1616
description='',
1717
license='PRIVATE',

ISO-on-TCP/src/ISO-on-TCP_example.py

+20-16
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@
2020
"T": snap7.snap7types.S7AreaTM
2121
}
2222

23+
# ISO-on-TCP settings
24+
scanner = {'name': 'iso_on_tcp_device', 'ip': '10.5.16.73', 'port': 102, 'rack': 0, 'slot': 0}
25+
26+
# variable settings
27+
vars = [
28+
{'name': 'power', 'register_type': 'Q', 'addr': 0, 'data_type': 'bool', 'operation': 'ro',
29+
'register_bit': 1},
30+
{'name': 'water', 'register_type': 'DB', 'dbnumber': 6, 'addr': 14, 'data_type': 'float',
31+
'operation': 'ro'},
32+
33+
{'name': 'tem', 'register_type': 'Q', 'addr': 6, 'data_type': 'dword', 'operation': 'ro'},
34+
{'name': 'pres', 'register_type': 'DB', 'dbnumber': 6, 'addr': 274, 'data_type': 'dword',
35+
'operation': 'ro'},
36+
37+
{'name': 'energ', 'register_type': 'M', 'addr': 6, 'data_type': 'dword', 'operation': 'rw',
38+
'write_value': 220},
39+
{'name': 'switch', 'register_type': 'DB', 'dbnumber': 6, 'addr': 18, 'data_type': 'string',
40+
'operation': 'ro', 'write_value': "test", 'len': 4},
41+
42+
]
2343

2444
# Configure logging
2545
logger = logging.getLogger()
@@ -314,21 +334,5 @@ def run(self):
314334

315335

316336
if __name__ == '__main__':
317-
# ISO-on-TCP settings
318-
scanner = {'name':'iso_on_tcp_device', 'ip': '10.5.16.73', 'port': 102, 'rack': 0, 'slot': 0}
319-
320-
# variable settings
321-
vars = [
322-
{'name': 'power', 'register_type': 'Q', 'addr': 0, 'data_type': 'bool', 'operation': 'ro', 'register_bit': 1},
323-
{'name': 'water', 'register_type': 'DB', 'dbnumber': 6, 'addr': 14, 'data_type': 'float', 'operation': 'ro'},
324-
325-
{'name': 'tem', 'register_type': 'Q', 'addr': 6, 'data_type': 'dword', 'operation': 'ro'},
326-
{'name': 'pres', 'register_type': 'DB', 'dbnumber': 6, 'addr': 274, 'data_type': 'dword', 'operation': 'ro'},
327-
328-
{'name': 'energ', 'register_type': 'M', 'addr': 6, 'data_type': 'dword', 'operation': 'rw', 'write_value': 220},
329-
{'name': 'switch', 'register_type': 'DB', 'dbnumber': 6, 'addr': 18, 'data_type': 'string', 'operation': 'ro', 'write_value': "test", 'len': 4},
330-
331-
]
332-
333337
ad = Adapter(scanner, vars)
334338
ad.run()

ISO-on-TCP/src/main.py

+1-22
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'''
77
import sys
88
import getopt
9-
from ISO_on_TCP_example import Adapter
9+
from ISO_on_TCP_example import Adapter, scanner, vars
1010

1111
def usage(cmd):
1212
print("usage: ")
@@ -28,27 +28,6 @@ def main(argv=sys.argv):
2828
for option, value in opts:
2929
if option in ('-h', '--help'):
3030
usage(argv[0])
31-
32-
# ISO-on-TCP settings
33-
scanner = {'name': 'iso_on_tcp_device', 'ip': '10.5.16.73', 'port': 102, 'rack': 0, 'slot': 0}
34-
35-
# variable settings
36-
vars = [
37-
{'name': 'power', 'register_type': 'Q', 'addr': 0, 'data_type': 'bool', 'operation': 'ro',
38-
'register_bit': 1},
39-
{'name': 'water', 'register_type': 'DB', 'dbnumber': 6, 'addr': 14, 'data_type': 'float',
40-
'operation': 'ro'},
41-
42-
{'name': 'tem', 'register_type': 'Q', 'addr': 6, 'data_type': 'dword', 'operation': 'ro'},
43-
{'name': 'pres', 'register_type': 'DB', 'dbnumber': 6, 'addr': 274, 'data_type': 'dword',
44-
'operation': 'ro'},
45-
46-
{'name': 'energ', 'register_type': 'M', 'addr': 6, 'data_type': 'dword', 'operation': 'rw',
47-
'write_value': 220},
48-
{'name': 'switch', 'register_type': 'DB', 'dbnumber': 6, 'addr': 18, 'data_type': 'string',
49-
'operation': 'ro', 'write_value': "test", 'len': 4},
50-
51-
]
5231
ad = Adapter(scanner, vars)
5332
ad.run()
5433
print("App was exit.")

aws_iot/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
'''
1010
from setuptools import setup, find_packages
1111
setup(name='ReplaceWithYourAppName',
12+
version='0.0.1',
1213
sdk_version='0.0.0',
13-
version='0.0.0',
14-
author='Inhand',
14+
author='InHand',
1515
author_email='',
1616
description='',
1717
license='PRIVATE',

azure_iot_device/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
'''
1010
from setuptools import setup, find_packages
1111
setup(name='ReplaceWithYourAppName',
12+
version='0.0.1',
1213
sdk_version='0.0.0',
13-
version='0.0.0',
14-
author='Inhand',
14+
author='InHand',
1515
author_email='',
1616
description='',
1717
license='PRIVATE',

ethernetip/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
'''
1010
from setuptools import setup, find_packages
1111
setup(name='ReplaceWithYourAppName',
12+
version='0.0.1',
1213
sdk_version='0.0.0',
13-
version='0.0.0',
14-
author='Inhand',
14+
author='InHand',
1515
author_email='',
1616
description='',
1717
license='PRIVATE',

modbus/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
'''
1010
from setuptools import setup, find_packages
1111
setup(name='ReplaceWithYourAppName',
12+
version='0.0.1',
1213
sdk_version='0.0.0',
13-
version='0.0.0',
14-
author='Inhand',
14+
author='InHand',
1515
author_email='',
1616
description='',
1717
license='PRIVATE',

modbus/src/main.py

+1-24
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'''
77
import sys
88
import getopt
9-
from modbus_example import MBMaster
9+
from modbus_example import MBMaster, mbProto, mbVal
1010

1111
def usage(cmd):
1212
print("usage: ")
@@ -29,29 +29,6 @@ def main(argv=sys.argv):
2929
if option in ('-h', '--help'):
3030
usage(argv[0])
3131

32-
# modbus slave settings
33-
# reconnect_interval only for TCP
34-
mbProto = {'reconnect_interval': 15.0, 'hostname': '10.5.16.234', 'type': 'TCP', 'port': 502,
35-
'slave': 1, 'byte_order': 'abcd'}
36-
# mbProto = {'type': 'RTU', 'serialPort': "/dev/tty03", 'baudrate':9600, "bytesize": 8, "parity":"N", "stopbits":1,
37-
# 'slave': 1, 'byte_order': 'abcd'}
38-
39-
# variable settings
40-
# if data_type is bit/bool, you should add register_bit key-word except the address
41-
# is between 1~10000、10001~20000、110001~165535
42-
# if data_type is string you should add len key-word
43-
# if write data to plc(operation with 'w'), you should add write_value key-word
44-
mbVal = [
45-
{'addr': 100, 'operation': 'rw', 'name': 'power', 'data_type': 'bit', 'write_value': 0},
46-
{'addr': 30001, 'operation': 'ro', 'name': 'model', 'data_type': "bit", 'register_bit': 1},
47-
{'addr': 30002, 'operation': 'ro', 'name': 'temperature', 'data_type': "int"},
48-
{'addr': 40001, 'operation': 'rw', 'name': 'speed', 'data_type': "word", 'write_value': 20},
49-
{'addr': 40011, 'operation': 'rw', 'name': 'speed222', 'data_type': "bit", 'register_bit': 10,
50-
'write_value': 1},
51-
{'addr': 40003, 'operation': 'rw', 'len': 4, 'name': 'pressure', 'data_type': 'string',
52-
'write_value': 'cvbn'},
53-
]
54-
5532
mbMaster = MBMaster(mbProto, mbVal)
5633
mbMaster.run()
5734
print("App was exit.")

modbus/src/modbus_example.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,27 @@
1414
import re
1515
import math
1616

17+
# modbus slave settings
18+
# reconnect_interval only for TCP
19+
mbProto = {'reconnect_interval': 15.0, 'hostname': '10.5.16.234', 'type': 'TCP', 'port': 502,
20+
'slave': 1, 'byte_order':'abcd'}
21+
# mbProto = {'type': 'RTU', 'serialPort': "/dev/tty03", 'baudrate':9600, "bytesize": 8, "parity":"N", "stopbits":1,
22+
# 'slave': 1, 'byte_order': 'abcd'}
23+
24+
# variable settings
25+
# if data_type is bit/bool, you should add register_bit key-word except the address
26+
# is between 1~10000、10001~20000、110001~165535
27+
# if data_type is string you should add len key-word
28+
# if write data to plc(operation with 'w'), you should add write_value key-word
29+
mbVal = [
30+
{'addr': 100, 'operation': 'rw', 'name': 'power', 'data_type': 'bit', 'write_value': 0},
31+
{'addr': 30001, 'operation': 'ro', 'name': 'model', 'data_type': "bit", 'register_bit':1},
32+
{'addr': 30002, 'operation': 'ro', 'name': 'temperature', 'data_type': "int"},
33+
{'addr': 40001, 'operation': 'rw', 'name': 'speed', 'data_type': "word", 'write_value': 20},
34+
{'addr': 40011, 'operation': 'rw', 'name': 'speed222', 'data_type': "bit", 'register_bit':10, 'write_value': 1},
35+
{'addr': 40003, 'operation': 'rw', 'len': 4, 'name': 'pressure', 'data_type': 'string', 'write_value': 'cvbn'}
36+
]
37+
1738

1839
class Utility(object):
1940
"""
@@ -519,26 +540,5 @@ def run(self):
519540

520541

521542
if __name__ == '__main__':
522-
# modbus slave settings
523-
# reconnect_interval only for TCP
524-
mbProto = {'reconnect_interval': 15.0, 'hostname': '10.5.16.234', 'type': 'TCP', 'port': 502,
525-
'slave': 1, 'byte_order':'abcd'}
526-
# mbProto = {'type': 'RTU', 'serialPort': "/dev/tty03", 'baudrate':9600, "bytesize": 8, "parity":"N", "stopbits":1,
527-
# 'slave': 1, 'byte_order': 'abcd'}
528-
529-
# variable settings
530-
# if data_type is bit/bool, you should add register_bit key-word except the address
531-
# is between 1~10000、10001~20000、110001~165535
532-
# if data_type is string you should add len key-word
533-
# if write data to plc(operation with 'w'), you should add write_value key-word
534-
mbVal = [
535-
{'addr': 100, 'operation': 'rw', 'name': 'power', 'data_type': 'bit', 'write_value': 0},
536-
{'addr': 30001, 'operation': 'ro', 'name': 'model', 'data_type': "bit", 'register_bit':1},
537-
{'addr': 30002, 'operation': 'ro', 'name': 'temperature', 'data_type': "int"},
538-
{'addr': 40001, 'operation': 'rw', 'name': 'speed', 'data_type': "word", 'write_value': 20},
539-
{'addr': 40011, 'operation': 'rw', 'name': 'speed222', 'data_type': "bit", 'register_bit':10, 'write_value': 1},
540-
{'addr': 40003, 'operation': 'rw', 'len': 4, 'name': 'pressure', 'data_type': 'string', 'write_value': 'cvbn'},
541-
]
542-
543543
mbMaster = MBMaster(mbProto, mbVal)
544544
mbMaster.run()

opcua_client/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
'''
1010
from setuptools import setup, find_packages
1111
setup(name='ReplaceWithYourAppName',
12+
version='0.0.1',
1213
sdk_version='0.0.0',
13-
version='0.0.0',
14-
author='Inhand',
14+
author='InHand',
1515
author_email='',
1616
description='',
1717
license='PRIVATE',

opcua_server/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
'''
1010
from setuptools import setup, find_packages
1111
setup(name='ReplaceWithYourAppName',
12+
version='0.0.1',
1213
sdk_version='0.0.0',
13-
version='0.0.0',
14-
author='Inhand',
14+
author='InHand',
1515
author_email='',
1616
description='',
1717
license='PRIVATE',

0 commit comments

Comments
 (0)