-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModbusConsts.py
182 lines (150 loc) · 4.02 KB
/
ModbusConsts.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/usr/bin/env python
##
# @package ModbusConsts Package conataining all the constant values used in Modbus Modules
#
class ModbusConsts:
QUERY_PARAMS = 'query_params'
DEVICE_ID = 'device_id'
DEVICE_TYPE = 'device_type'
CONN_TYPE = 'connection_type'
CONN_PARAMS = 'connection_param'
DEVICE_CATEGORY = 'device_category'
CAT_INVERTER = 'inverter'
CAT_INVERTER_ABB33 = 'inverter_abb33'
CAT_INVERTER_ABB100 = 'inverter_abb100'
CAT_WST = 'wst'
SLAVE_ID = 'slave_id'
# Serial Connection parameters
BAUDRATE = 'baud_rate'
PARITY = 'parity'
STOP_BITS = 'stop_bits'
BYTE_SIZE = 'byte_size'
# TCP Connection Paramters
HOST = 'host'
PORT = 'port'
# Register parameters
FUNCTION_ID = 'function_id'
START_REG = 'start_register'
REG_COUNT = 'register_count'
# Connection types
CONN_RTU = 'RTU'
CONN_TCP = 'TCP'
CONN_RTU_TCP = 'RTUoverTCP'
CONN_RTU_LORA = 'RTUoverLORA'
CONN_TYPE_SLAVE_RS485 = 'SlaveRS485'
CONN_TYPE_SLAVE_LORA = 'SlaveLora'
# TCS related constants
TCS_DATA = 'tcs_data'
TCS_LINK_TYPE = 'tcs_link_type'
TCS_LINK_LORA_NODE = 'LoraNode'
TCS_LINK_GATEWAY = 'gateway'
TCS_SERVICE = 'tcs_service'
TCS_VERSION = 'tcs_version'
TCS_OFFERING = 'tcs_offering'
TCS_OBS_SENSOR = 'obs_sensor'
TCS_OBS_FEATURE = 'obs_feature'
TCS_GEO_TYPE = 'tcs_geo_type'
TCS_COORD_ALTITUDE = 'tcs_coord_alt'
TCS_COORD_LATITUDE = 'tcs_coord_lat'
TCS_COORD_LONGITUDE = 'tcs_coord_long'
# Parity types
PARITY_NONE = 'none'
PARITY_EVEN = 'even'
PARITY_ODD = 'odd'
PARITY_MARK = 'mark'
PARITY_SPACE = 'space'
# Stop bits
SB_ONE = 1
SB_ONE_POINT_FIVE = 1.5
SB_TWO = 2
# Byte sizes
BYTE_FIVE = 5
BYTE_SIX = 6
BYTE_SEVEN = 7
BYTE_EIGHT = 8
# Slave card params
SLAVE_CARD_ID = 'slave_card_id'
DEVICE_TYPE_DELTA = 'INVERTER_DELTA_RPIM3_SLAVE'
DEVICE_TYPE_ABB33 = 'INVERTER_ABB_33KW_SLAVE'
DEVICE_TYPE_ABB100 = 'INVERTER_ABB_100KW_SLAVE'
DEVICE_TYPE_SLAVE_SENSOR = ''
# Decoding config sections
PREPROCESS = 'preprocess'
VALUE_MAP = 'value_map'
DATA = 'data'
ALARM = 'alarm'
DEFAULT = 'default'
PARAMS = 'params'
# Decoding parameter list
PARAM_NAME = 'name'
REG_SIZE = 'register_size'
PARAM_SIZE = 'param_size'
PARAM_TYPE = 'type'
BYTE_OFFSET = 'byte_offset'
BIT_OFFSET = 'bit_offset'
SIGN = 'sign'
FORMULA = 'formula'
MAP_KEY = 'map_key'
DEFAULT_VALUE = 'value'
# Parameter types
TYPE_INT = 'Integer'
TYPE_FLOAT = 'Float'
TYPE_STRING = 'String'
TYPE_HEX = 'hex'
TYPE_RAW = 'Raw'
TYPE_SWAP_FLOAT_8 = 'SwappedFloat8'
TYPE_SWAP_FLOAT_8R = 'SwappedFloat8R'
TYPE_SWAP_FLOAT_16 = 'SwappedFloat16'
TYPE_SWAP_INT_8 = 'SwappedInt8'
TYPE_SWAP_INT_16 = 'SwappedInt16'
SIGN_S = 'S'
SIGN_U = 'U'
PARAM_MIN = 'min_val'
PARAM_MAX = 'max_val'
# Solar Inverter Parameters
SLR_WSNSR = 'WSNSR'
SLR_TEMP = 'TEMP'
SLR_HUMI = 'HUMI'
SLR_RELAY = 'RELAY'
SLR_RAIN = 'RAIN'
SLR_WINDS = 'WINDS'
SLR_WINDD = 'WINDD'
SLR_ANLG1 = 'ANLG1'
SLR_IPPWR = 'IPPWR'
SLR_DCIP = 'DCIP'
SLR_DCV = 'DCV'
SLR_DCA = 'DCA'
SLR_DCW = 'DVW'
SLR_MDCIP = 'MDCIP'
SLR_OPPWR = 'OPPWR'
SLR_ACOP = 'ACOP'
SLR_ACV = 'ACV'
SLR_ACA = 'ACA'
SLR_ACW = 'ACW'
SLR_FRQ = 'FRQ'
SLR_MACOP = 'MACOP'
SLR_APP = 'APP'
SLR_APP1 = 'APP1'
SLR_APP2 = 'APP2'
SLR_APP3 = 'APP3'
SLR_EVT = 'EVT'
SLR_RCP = 'RCP'
SLR_COSFI = 'COSFi'
SLR_PF = 'PF'
SLR_STR = 'STR'
SLR_WATTHT = 'WattH_T'
SLR_RUNTT = 'RunT_T'
SLR_WATTH = 'WattH'
SLR_RUNT = 'RunT'
SLR_OP_STATE = 'Op_State'
SLR_REC_TIME = 'RecTime'
#Weather Station Parameters
WST_WSNSR = 'WSNSR'
WST_TEMP = 'TEMP'
WST_HUMI = 'HUMI'
WST_RELAY = 'RELAY'
WST_RAIN = 'RAIN'
WST_WINDS = 'WINDS'
WST_WINDD = 'WINDD'
WST_ANLG1 = 'ANLG1'
CUSTOM_ALARM_PROCESSORS = {}