I have a profibus connection between a wonderware application and a PLC. I did my 1st experience with libnodave by connecting the same PLC to a delphi application through this library.
Reading and writting bunch of bytes to DBs inside the PLC works fine but the time spent to read all DBs looks long. I assume ~20 ms/DB and given the large amount of data, this is ~1s to read all DBs. Is that timing correct ? or is there another solution to go faster (less DBs but larger size ?)
If this bottleneck is due to the the way the PLC manage the IP connexion, i should also assume that another IP solution different from libnodave will not provide better results. In this case faster communication means that i should go back to profibus.
Thanks in advance for any help and comments
benoit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Two things to achieve speed:
- do NOT close and reopen connections!
- read blocks of maximum size
How much data tranfers wonderware to and from the PLC and in which time? I can't imagine it does better than Libnodave.
What Libnodave does is "S7 communication". There is still another way of communication with Simatic and Ethernet: S5 compatible communication with FETCH/WRITE calls. Cannot tell you what it's performance is.
The following is true for S7 communication:
A single call to daveReadBytes can transport the size of PDU (240, 480, 960) -18 bytes. Everything else needs multiple calls to daveReadBytes and multiple requests/responses in S7 communication. This limit is introduced by S7 communication.
Less but greater DBs will be faster because of one of these:
- if you read less than PDU size limit, you have one daveReadBytes per DB, less DBs less read calls.
- if you read more than PDU size limit, first calls will transfer maximum block size while the last call will read the rest. Less DBs less calls to read rests, while most reads will read max size.
if you have very short groups of bytes spread all over PLC memory, you can read multiple items, but it is quite complicated a calculation to determine how much fits into a singel PDU.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"if you have very short groups of bytes spread all over PLC memory, you can read multiple items, but it is quite complicated a calculation to determine how much fits into a singel PDU. "
I have also problems with the speed because I have to read only 4 or 8 bytes from many diffrent DBs.
Is there a way to read them in one request?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PDU p;
daveResultSet rs; // a special structure to hold result data
davePrepareReadRequest(dc, &p); // This prepares a read request
daveAddVarToReadRequest(&p,daveInputs,0,0,1); // Adds a request to read 1 byte from IB0
daveAddVarToReadRequest(&p,daveFlags,0,0,4); // Adds a request to read 4 bytes from FB0
daveAddVarToReadRequest(&p,daveDB,6,20,2); // Adds a request to read 2 bytes from DB6:DBB20
daveAddVarToReadRequest(&p,daveFlags,0,12,2); // Adds a request to read 2 bytes from FB12
res=daveExecReadRequest(dc, &p, &rs); // Execute all these requests
/*
Now, res has the information whether the entire request succeeded.
If so, the result set contains the four results and their error states. For the exact
structure refer to nodaveCommon.h. To read the data using the conversion functions
like daveGetByte, daveGetWORD etc., you have to call daveUseResult(dc, rs, <result number>)
first. daveUseResult() also returns the error status for this particular result.
*/
res=daveUseResult(dc, rs, 0); // first result
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a profibus connection between a wonderware application and a PLC. I did my 1st experience with libnodave by connecting the same PLC to a delphi application through this library.
Reading and writting bunch of bytes to DBs inside the PLC works fine but the time spent to read all DBs looks long. I assume ~20 ms/DB and given the large amount of data, this is ~1s to read all DBs. Is that timing correct ? or is there another solution to go faster (less DBs but larger size ?)
If this bottleneck is due to the the way the PLC manage the IP connexion, i should also assume that another IP solution different from libnodave will not provide better results. In this case faster communication means that i should go back to profibus.
Thanks in advance for any help and comments
benoit
Two things to achieve speed:
- do NOT close and reopen connections!
- read blocks of maximum size
How much data tranfers wonderware to and from the PLC and in which time? I can't imagine it does better than Libnodave.
What Libnodave does is "S7 communication". There is still another way of communication with Simatic and Ethernet: S5 compatible communication with FETCH/WRITE calls. Cannot tell you what it's performance is.
The following is true for S7 communication:
A single call to daveReadBytes can transport the size of PDU (240, 480, 960) -18 bytes. Everything else needs multiple calls to daveReadBytes and multiple requests/responses in S7 communication. This limit is introduced by S7 communication.
Less but greater DBs will be faster because of one of these:
- if you read less than PDU size limit, you have one daveReadBytes per DB, less DBs less read calls.
- if you read more than PDU size limit, first calls will transfer maximum block size while the last call will read the rest. Less DBs less calls to read rests, while most reads will read max size.
if you have very short groups of bytes spread all over PLC memory, you can read multiple items, but it is quite complicated a calculation to determine how much fits into a singel PDU.
"if you have very short groups of bytes spread all over PLC memory, you can read multiple items, but it is quite complicated a calculation to determine how much fits into a singel PDU. "
I have also problems with the speed because I have to read only 4 or 8 bytes from many diffrent DBs.
Is there a way to read them in one request?
I found it by myself in the Readme.
PDU p;
daveResultSet rs; // a special structure to hold result data
davePrepareReadRequest(dc, &p); // This prepares a read request
daveAddVarToReadRequest(&p,daveInputs,0,0,1); // Adds a request to read 1 byte from IB0
daveAddVarToReadRequest(&p,daveFlags,0,0,4); // Adds a request to read 4 bytes from FB0
daveAddVarToReadRequest(&p,daveDB,6,20,2); // Adds a request to read 2 bytes from DB6:DBB20
daveAddVarToReadRequest(&p,daveFlags,0,12,2); // Adds a request to read 2 bytes from FB12
res=daveExecReadRequest(dc, &p, &rs); // Execute all these requests
/*
Now, res has the information whether the entire request succeeded.
If so, the result set contains the four results and their error states. For the exact
structure refer to nodaveCommon.h. To read the data using the conversion functions
like daveGetByte, daveGetWORD etc., you have to call daveUseResult(dc, rs, <result number>)
first. daveUseResult() also returns the error status for this particular result.
*/
res=daveUseResult(dc, rs, 0); // first result