You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to connect with Siemens 840D machine using Python S7 connection on Profinet communication.
I am able to connect with system on Profinet and getting data in Python. But not able to take specific data such as Axis current, Axis load, Actual Axis Speed, Axis Motor temp. etc. These parameters are belong to VFD (used for servo) used in CNC Machine.
Can you please share the methodology for the same?
Below are example code of Python, with this I am able to communicate and getting other data but not the above said parameters.
Either there will be some technique I have to use to take above parameters of VFD or I am not able to use correct address of above parameters.
Can anyone suggest inputs that can help me to solve this issue?
Example Python code1 to get Bool Data :
import snap7
import json
import struct
plc = snap7.client.Client()
plc.connect('192.168.0.1', 0, 1)
In this example boolean in DB 31 at byte 120 and bit 5 is changed. = 120.5
reading = plc.db_read(1,8,1 ) # read 1 byte from db 31 staring from byte 120
#data = plc.db_read(1,0,4)
#real_number = struct.unpack('>f', data)[0]
#print(f"Real number read from DB1 at byte offset 0: {real_number}")
a = snap7.util.get_bool(reading, 0, 0) # set a value of fifth bit
a1 = snap7.util.get_bool(reading, 0, 1) # set a value of fifth bit
a2 = snap7.util.get_bool(reading, 0, 2) # set a value of fifth bit
a3 = snap7.util.get_bool(reading, 0, 3) # set a value of fifth bit
a4 = snap7.util.get_bool(reading, 0, 4) # set a value of fifth bit
a5 = snap7.util.get_bool(reading, 0, 5) # set a value of fifth bit
a6 = snap7.util.get_bool(reading, 0, 6) # set a value of fifth bit
a7 = snap7.util.get_bool(reading, 0, 7) # set a value of fifth bit
Hi,
I am trying to connect with Siemens 840D machine using Python S7 connection on Profinet communication.
I am able to connect with system on Profinet and getting data in Python. But not able to take specific data such as Axis current, Axis load, Actual Axis Speed, Axis Motor temp. etc. These parameters are belong to VFD (used for servo) used in CNC Machine.
Can you please share the methodology for the same?
Below are example code of Python, with this I am able to communicate and getting other data but not the above said parameters.
Either there will be some technique I have to use to take above parameters of VFD or I am not able to use correct address of above parameters.
Can anyone suggest inputs that can help me to solve this issue?
Example Python code1 to get Bool Data :
import snap7
import json
import struct
plc = snap7.client.Client()
plc.connect('192.168.0.1', 0, 1)
In this example boolean in DB 31 at byte 120 and bit 5 is changed. = 120.5
reading = plc.db_read(1,8,1 ) # read 1 byte from db 31 staring from byte 120
#data = plc.db_read(1,0,4)
#real_number = struct.unpack('>f', data)[0]
#print(f"Real number read from DB1 at byte offset 0: {real_number}")
a = snap7.util.get_bool(reading, 0, 0) # set a value of fifth bit
a1 = snap7.util.get_bool(reading, 0, 1) # set a value of fifth bit
a2 = snap7.util.get_bool(reading, 0, 2) # set a value of fifth bit
a3 = snap7.util.get_bool(reading, 0, 3) # set a value of fifth bit
a4 = snap7.util.get_bool(reading, 0, 4) # set a value of fifth bit
a5 = snap7.util.get_bool(reading, 0, 5) # set a value of fifth bit
a6 = snap7.util.get_bool(reading, 0, 6) # set a value of fifth bit
a7 = snap7.util.get_bool(reading, 0, 7) # set a value of fifth bit
data = {
}
data = json.dumps(data)
print(data)
Regards
Abhishek
The text was updated successfully, but these errors were encountered: