scy-phy / minicps

MiniCPS: a framework for Cyber-Physical Systems real-time simulation, built on top of mininet
MIT License
165 stars 70 forks source link

Device receive function not working #30

Closed tnowak1502 closed 2 years ago

tnowak1502 commented 3 years ago

When trying to run the swat-s1 tutorial, I am running into the same problem mentioned in issue #28, where the receive function returns nothing. I tried uninstalling cpppo and installing version 4.3.4, but the issue still occurs and additionally, a warning pops up: "/usr/lib/python3.8/runpy.py:127: RuntimeWarning: 'cpppo.server.enip.client' found in sys.modules after import of package 'cpppo.server.enip', but prior to execution of 'cpppo.server.enip.client'; this may result in unpredictable behaviour"

I also tried replacing the enip protocol with modbus in the utils file, but that leads to some different error messages: "/usr/bin/python3: can't open file '/usr/local/lib/python3.8/dist-packages/minicps/pymodbus/servers.py': [Errno 2] No such file or directory" and "/usr/bin/python3: can't open file '/usr/local/lib/python3.8/dist-packages/minicps/pymodbus/synch-client.py': [Errno 2] No such file or directory" and "ERROR modbus _receive: local variable 'out' referenced before assignment"

K0zero commented 2 years ago

i also have the same problem, did you solve this problem?

tnowak1502 commented 2 years ago

I'm not sure if I'm remembering correctly, I may have somehow solved this issue, but if I did I don't know how. However, it's also possible that I ignored the issue, since I only implemented a very simplistic system. Sorry I'm not able to offer any help, I only used minicps very briefly last year.

noleti commented 2 years ago

Thanks for the report, sorry for the very delayed response. I am currently looking into related issues. With CPPPO == 4.3.4, I do not run into #28, but I do get the runtime warning as well. That does not have an impact on the correct execution of the example code, so it can be ignored. I will open a separate issue (#30, with low priority) to investigate the warning message further. I will close this issue here, as it seems to mix several problems (CPPPO return isse #28, the new #30, and the problem with manual replacement of enip with modbus).