-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can s7netplus read cpu status? #489
Comments
At the moment it can't. If I'm not mistaken I have seen this implemented in an open source library, I'll try to find it and then I should be able to add it to S7NetPlus as well... |
I've spent a couple of hours searching, but couldn't find any implementation yet. However, I did find a Wireshark dump that contains PLC status, the Wireshark S7 dissector actually knows the meaning of all the values, so I'll try to use that as base. I won't be able to test this on short notice myself, but I'll try to add the functionality, maybe you can test it for me? |
Sure, I can test this it with a real PLC. If you finished, @ me, I will test it. And more, I found something from snap7/sharp7/plc4x, maybe helpful? int TSnap7MicroClient::opGetPlcStatus()
{
int *Status;
int Result;
Status =(int*)Job.pData;
Job.ID =0x0424;
Job.Index =0x0000;
Job.IParam =0;
Result =opReadSZL();
if (Result==0)
{
switch (opData[7])
{
case S7CpuStatusUnknown :
case S7CpuStatusRun :
case S7CpuStatusStop : *Status=opData[7];
break;
default :
// Since RUN status is always $08 for all CPUs and CPs, STOP status
// sometime can be coded as $03 (especially for old cpu...)
*Status=S7CpuStatusStop;
}
}
else
*Status=0;
return Result;
} |
I had actually looked at Snap7 and missed this one. It's certainly useful, because I was going to use SZL I expect I have this working somewhere next week, no promises on exact date because I'm actually on holiday till tuesday. Half of it seems to be in place now though, I expect the request to be fine so it's a matter of handling the response mostly. |
Hi @Himmelt, sorry for the delay on this. PR #491 might actually work, I'm not 100% sure if I used the correct offset though. I intend to add a unit test to verify, but just haven't gotten to doing that yet. In the meantime, you can download the NuGet package that's created by the create_nuget action. Keep in mind that I implemented it as returning the status as a |
Hi @mycroes , I have tested it with 1500 on PLCSIM Advanced and an actual 1500 PLC, but got the same
|
@mycroes I tested this function with source code in debug mode, and got this: |
Wow, index 94 is way off, not sure how I ever calculated that. I started the unit test preparation yesterday, I intend to finish that today and I'll fix the index so this works. Thanks for testing! |
Hi @Himmelt, if you want to take this for another spin it should now be working! Let me know if it works, if it does I'll merge and release. |
@mycroes It works ! I have tested S7300/S7400/S71200 running on PLCSIM with NetToPlcsim, and S71500 running on PLCSIM Advanced, and an actual S7-1511T-1 PLC, all works ! |
Just released as v0.20.0! |
Can s7netplus read cpu status?
I want to display target cpu is runing or stopping in app ui.
The text was updated successfully, but these errors were encountered: