138 "var_name": "var_name", |
138 "var_name": "var_name", |
139 "location": "X" + ".".join([str(i) for i in current_location]) + ".0.0", |
139 "location": "X" + ".".join([str(i) for i in current_location]) + ".0.0", |
140 "description": "Modbus request execution control flag", |
140 "description": "Modbus request execution control flag", |
141 "children": []}) |
141 "children": []}) |
142 entries.append({ |
142 entries.append({ |
143 "name": "Request Status flag", |
143 "name": "Modbus Request Status flag", |
144 "type": LOCATION_VAR_MEMORY, |
144 "type": LOCATION_VAR_MEMORY, |
145 "size": 16, # WORD flag |
145 "size": 8, # BYTE flag |
146 "IEC_type": "WORD", # WORD flag |
146 "IEC_type": "BYTE", # BYTE flag |
147 "var_name": "var_name", |
147 "var_name": "var_name", |
148 "location": "W" + ".".join([str(i) for i in current_location]) + ".0.1", |
148 "location": "B" + ".".join([str(i) for i in current_location]) + ".0.1", |
149 "description": "Modbus request status flag", |
149 "description": "Modbus request status flag", |
|
150 "children": []}) |
|
151 entries.append({ |
|
152 "name": "Modbus Error Code", |
|
153 "type": LOCATION_VAR_MEMORY, |
|
154 "size": 8, # BYTE flag |
|
155 "IEC_type": "BYTE", # BYTE flag |
|
156 "var_name": "var_name", |
|
157 "location": "B" + ".".join([str(i) for i in current_location]) + ".0.2", |
|
158 "description": "Modbus Error Code received in Modbus error frame", |
150 "children": []}) |
159 "children": []}) |
151 for offset in range(address, address + count): |
160 for offset in range(address, address + count): |
152 entries.append({ |
161 entries.append({ |
153 "name": dataname + " " + str(offset), |
162 "name": dataname + " " + str(offset), |
154 "type": LOCATION_VAR_MEMORY, |
163 "type": LOCATION_VAR_MEMORY, |
895 if str(iecvar["NAME"]) not in loc_vars_list: |
904 if str(iecvar["NAME"]) not in loc_vars_list: |
896 # Add if it is a Execution Request Flag (mapped onto %QXa.b.c.0.0), so last number is a '0' |
905 # Add if it is a Execution Request Flag (mapped onto %QXa.b.c.0.0), so last number is a '0' |
897 if iecvar["LOC"][4] == 0: |
906 if iecvar["LOC"][4] == 0: |
898 loc_vars.append("u16 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_exec_req;" % (client_requestid)) |
907 loc_vars.append("u16 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_exec_req;" % (client_requestid)) |
899 loc_vars_list.append(str(iecvar["NAME"])) |
908 loc_vars_list.append(str(iecvar["NAME"])) |
900 # Add if it is a Communication Status Flag (mapped onto %QWa.b.c.0.1), so last number is a '1' |
909 # Add if it is a "Modbus Request Status flag" (mapped onto %QWa.b.c.0.1), so last number is a '1' |
901 if iecvar["LOC"][4] == 1: |
910 if iecvar["LOC"][4] == 1: |
902 loc_vars.append("u16 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_exec_status;" % (client_requestid)) |
911 loc_vars.append("u8 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_tn_error_code;" % (client_requestid)) |
|
912 loc_vars_list.append(str(iecvar["NAME"])) |
|
913 # Add if it is a "Modbus Error code" (mapped onto %QWa.b.c.0.2), so last number is a '2' |
|
914 if iecvar["LOC"][4] == 2: |
|
915 loc_vars.append("u8 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_mb_error_code;" % (client_requestid)) |
903 loc_vars_list.append(str(iecvar["NAME"])) |
916 loc_vars_list.append(str(iecvar["NAME"])) |
904 client_requestid += 1 |
917 client_requestid += 1 |
905 tcpclient_node_count += 1 |
918 tcpclient_node_count += 1 |
906 client_nodeid += 1 |
919 client_nodeid += 1 |
907 # |
920 # |
945 if str(iecvar["NAME"]) not in loc_vars_list: |
958 if str(iecvar["NAME"]) not in loc_vars_list: |
946 # Add if it is a Execution Request Flag (mapped onto %QXa.b.c.0.0), so last number is a '0' |
959 # Add if it is a Execution Request Flag (mapped onto %QXa.b.c.0.0), so last number is a '0' |
947 if iecvar["LOC"][4] == 0: |
960 if iecvar["LOC"][4] == 0: |
948 loc_vars.append("u16 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_exec_req;" % (client_requestid)) |
961 loc_vars.append("u16 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_exec_req;" % (client_requestid)) |
949 loc_vars_list.append(str(iecvar["NAME"])) |
962 loc_vars_list.append(str(iecvar["NAME"])) |
950 # Add if it is a Communication Status Flag (mapped onto %QWa.b.c.0.1), so last number is a '1' |
963 # Add if it is a "Modbus Request Status flag" (mapped onto %QWa.b.c.0.1), so last number is a '1' |
951 if iecvar["LOC"][4] == 1: |
964 if iecvar["LOC"][4] == 1: |
952 loc_vars.append("u16 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_exec_status;" % (client_requestid)) |
965 loc_vars.append("u8 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_tn_error_code;" % (client_requestid)) |
|
966 loc_vars_list.append(str(iecvar["NAME"])) |
|
967 # Add if it is a "Modbus Error code" (mapped onto %QWa.b.c.0.2), so last number is a '2' |
|
968 if iecvar["LOC"][4] == 2: |
|
969 loc_vars.append("u8 *" + str(iecvar["NAME"]) + " = &client_requests[%d].flag_mb_error_code;" % (client_requestid)) |
953 loc_vars_list.append(str(iecvar["NAME"])) |
970 loc_vars_list.append(str(iecvar["NAME"])) |
954 client_requestid += 1 |
971 client_requestid += 1 |
955 rtuclient_node_count += 1 |
972 rtuclient_node_count += 1 |
956 client_nodeid += 1 |
973 client_nodeid += 1 |
957 nodeid += 1 |
974 nodeid += 1 |