Comments (15)
Global symname must start with a dot: .engine
, program symname must start with the programname: MAIN.UpTyp.timerUp.PT
.
There is also a problem with special characters, because node-ads pass the texts as UTF8 to the PLC and not as ASCII. Do you want to tell us the symname name?
You can use getSymbols to trace the known names.
client = ads.connect(options, function() {
this.getSymbols(function(err, symbols) {
if (err) console.log(err)
console.log(symbols)
this.end()
})
})
client.end(function (){ resolve() })
resolve()
better you remove the second resolve() ;-)
from node-ads.
So you mean the old value of synhandle is persisting through the multiple calls?
yes that's javascript
from node-ads.
This is the failing handle
var validityHandle = {
symname: 'MAIN.PKG.bEnable',
bytelength: ads.BOOL,
propname: 'value',
value: true
}
The successful ones are MAIN.PKG.BLA_BLA
matching exactly to the ones declared in PLC. The type of others are mixed, including float, bool, though I don't think it's related. As I stated, the error "symbol not found" happens occasionally, but with some pattern. If I just start my node app, first(or first few) times everything is successful. The program is running on setInterval
of 5 minutes. On consequent timer events, the exception occurs.
from node-ads.
better you remove the second resolve() ;-)
ah, dankeschön :)
from node-ads.
So what I tried is moved then(() => WriteAds(client, validityHandle)).
to the top, to see if the failure is related to the last Write, but it failed again on exactly this handle. If something wrong with the name of the handle, why it's writing successfully always very first time?
from node-ads.
I think the second resolve() is not the problem here.
I am puzzled about:
The last one only received ADSIGRP_SYM_VALBYHND without prior ADSIGRP_SYM_HNDBYNAME.
node-ads has a peculiarity, it writes all information into the transferred object validityHandle. ADSIGRP_SYM_HNDBYNAME is not called when a handle is handed over. But then the symname is forbidden.
I am confused
from node-ads.
So I have bunch of ADSIGRP_SYM_HNDBYNAME calls like below for all handles in values
array:
Then all of the sudden I see ADSIGRP_SYM_VALBYHND
to read the value for bEnable
I guess, not sure where it got index/offset:
Tomorrow I'm going to do getSymbols
, to see if the index/offset is matching. Second, I'm going to capture the first successful operation and compare.
from node-ads.
I did a quick capture of successful call and I see ADSIGRP_SYM_HNDBYNAME
from node-ads.
this is a part of var getHandle = function
if (typeof handle.symhandle === 'undefined') {
var commandOptions = {
indexGroup: ADSIGRP.GET_SYMHANDLE_BYNAME,
indexOffset: 0x00000000,
writeBuffer: buf,
readLength: 4,
symname: handle.symname
}
writeReadCommand.call(ads, commandOptions, function (err, result) {
.....
}
plase try only for a test:
function WriteAds(client, h)
{
return new Promise(function(resolve, reject){
client.write(h, function(err) {
delete(h.symhandle)
if (err)
{
reject(err)
}
else
{
resolve()
}
})
})
}
or use a clean object:
function WriteAds(client, h)
{
return new Promise(function(resolve, reject){
var newH = Object.assign({},h)
client.write(newH, function(err) {
if (err)
{
reject(err)
}
else
{
resolve()
}
})
})
}
because client.end releases all symhandle you got in the session
var end = function (cb) {
...
releaseSymHandles.call(ads, function () {
...
Did you slove the connection problem on the localhost?
from node-ads.
So you mean the old value of symhandle is persisting through the multiple calls? Can be true, because only that object is static and I never reset it. I'll try it tomorrow morning, off to bed now. Thanks!
from node-ads.
If I look at the code, it looks like you would pick up a value via http-get and send it to the PLC.
Ever thought about NODE-RED?
Timer Node -> HTTP Request Node -> ADS Write Node
from node-ads.
Did you slove the connection problem on the localhost?
I'll update previous topic in a moment
from node-ads.
If I look at the code, it looks like you would pick up a value via http-get and send it to the PLC.
Ever thought about NODE-RED?Timer Node -> HTTP Request Node -> ADS Write Node
My web request is pretty complex and requires login, cookies, cheerio, header case normalization to extract data. The function is already there(around 200 lines of code) and I'm not sure if I can easily do it with HTTP Request Node.
Also for ADS I need to write float values, extracted from the web, then at the end put validity flag, before invalidation timer expires in PLC. Not sure if this can be achieved in NR as flexible as I do it in single js file.
Currently I installed it as windows service, using node-windows and it's running smoothly. Thanks to you, the problem with symbol not found solved (though I think lib should not keep the state in user object).
With that said, I love NR and always looking for opportunities to use it. But for this task it feels like shooting bird with canon.
from node-ads.
Thanks to you, the problem with symbol not found solved
Added note in the readme.md
@roccomuso please close
from node-ads.
ok thanks!
from node-ads.
Related Issues (20)
- Promise support HOT 12
- Couldn't read array values from beckhoff machines HOT 2
- I use a CX5020 for my trials and also have problems to connect HOT 8
- Couldn't write array to beckhoff machines. HOT 2
- getSymbols bug fix is not available on npm HOT 8
- multiWrite: Error: parameter size not correct HOT 4
- Enable two connections from same PC: Offer IP binding for source IP in constructor HOT 1
- use multi read HOT 4
- Socket closes after 10 seconds - Error: This socket has been ended by the other party HOT 2
- ECONNRESET or timeout when trying to access remote TwinCAT HOT 2
- Read / Write / Notify on Index Group / Offset HOT 2
- Publish latest version to npm HOT 1
- Typescript, Testing, Linting HOT 3
- Error: "Ads Register Notification timeout HOT 1
- Notifications don't work HOT 1
- Does this work on non windows machine? HOT 4
- Notifications don't work HOT 1
- multiRead - Error: parameter size not correct HOT 16
- How to access local ads server? HOT 29
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 node-ads.