Comments (4)
I looked briefly at B4X. Seems nice, but it is commercial. If you are working on a new wrapper, I would suggest wrapping the C library directly.
The way that you are calling each tag with a timeout will serialize the tag access and prevent the library from getting good performance.
For the best performance, you should start reading in asynchronous mode. You do that by calling read, but with a timeout of zero. The C library will start reading in the background. You can either set up a callback function or check the status of the tag to tell when the read is done. The status will be PLCTAG_STATUS_PENDING while the read is happening and will change to PLCTAG_STATUS_OK when it is done. If it changes to anything else, an error occurred. The example program async.c shows how to do this (in C, so hopefully you can translate that to your language).
from libplctag4j.
Something like this?
Private Sub bucle
Do While working
rc=tag4.Read(0)
If Not(rc=tag4.PLCTAG_STATUS_OK) Then
' Log ("Unable to create the tag")
Else
' Log("Tag created")
End If
val4 = tag4.GetString(0)
LabelTAG_STRING.Text = val4
Sleep(50)
Loop
End Sub
it works really well, I was just wondering if reading the status of many tags constantly affects the performance of the device.
from libplctag4j.
Reading status does not impact performance. Only read() and write() go to the PLC. Inside the library these are asynchronous operations. If you have a timeout, then the library waits at least that long for the operation to complete. If you have no timeout then the library will start the operation and you can wait for it to complete by checking the status. Internally, the library will check for a response from the PLC.
The PLC cannot handle a very high rate of network packets. But, it can handle many requests per packet. So the best performance is to use asynchronous mode and trigger many reads/writes at once, then wait for them to complete.
from libplctag4j.
thanks for the explanation
from libplctag4j.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libplctag4j.