Comments (6)
Hi!
I tested it on my local PC running TwinCAT 4024.10 and ads-client 1.12.1. Reading TOD
and TIME_OF_DAY
both worked fine.
What versions are you using?
PLC:
//GVL_Test
testTOD : TOD := TOD#15:30;
Javascript:
const data = await client.readSymbol('GVL_Test.testTOD')
console.log(data)
Console output:
{
value: 55800000,
type: {
name: '',
type: 'TIME_OF_DAY',
size: 4,
offset: 0,
adsDataType: 19,
adsDataTypeStr: 'ADST_UINT32',
comment: '',
attributes: [],
rpcMethods: [],
arrayData: [],
subItems: []
},
symbol: {
indexGroup: 16448,
indexOffset: 455700,
size: 4,
adsDataType: 19,
adsDataTypeStr: 'ADST_UINT32',
flags: 8,
flagsStr: [ 'TypeGuid' ],
arrayDimension: 0,
nameLength: 16,
typeLength: 11,
commentLength: 0,
name: 'GVL_Test.testTOD',
type: 'TIME_OF_DAY',
comment: '',
arrayData: [],
typeGuid: '9519071800000000000000000000004b',
attributes: [],
reserved: <Buffer 00 00 00 00>
}
}
from ads-client.
What versions are you using?
I am using Twincat 2 on a CX9020:
TC CE Build: 354
TC Build: 2258
In the PLC I have a a function block as follows:
FUNCTION_BLOCK GetSystemTime_FB
VAR_OUTPUT
dt_DateTime: DT;
t_Time: TIME;
tod_TimeOFDay: TOD;
B_DayOfWeek: BYTE;
w_TaskCyclus: WORD;
st_Time: TIMESTRUCT;
END_VAR
VAR
GetTime: NT_GetTime;
GetTaskCyclus: GETTASKTIME;
d_Task_High_Before: DWORD;
d_Task_Low_Before: DWORD;
d_Task_High: DWORD;
d_Task_Low: DWORD;
END_VAR
I have an instance of that function block in a global variable list:
SystemTime: GetSystemTime_FB;
And the following Javascript yields the same error:
(async () => {
const client = new ads.Client({
targetAmsNetId: ams,
targetAdsPort: 801,
})
await client.connect()
console.log(await client.readSymbol(".systemtime"))
await client.disconnect()
})()
ClientException: Reading data type info for TOD failed
from ads-client.
Ok thanks! The reason is that in TC2 the PLC doesn't provide information for basic data types, however this library should handle it. Does it work with TIME_OF_DAY
instead? The reason probably is that I have forgotten to add TOD
to base data types (TIME_OF_DAY
is there).
Please edit line 1014 from ads-client-ads.js:
https://github.com/jisotalo/ads-client/blob/master/src/ads-client-ads.js#L1014
name: ['UDINT', 'DWORD', 'TIME', 'TIME_OF_DAY', 'BITARR32', 'UINT32'],
-->
name: ['UDINT', 'DWORD', 'TIME', 'TIME_OF_DAY', 'TOD', 'BITARR32', 'UINT32'],
Does it work now?
from ads-client.
It works!
from ads-client.
Great! I'll fix it in the library too.
from ads-client.
Fixed in v. 1.12.2
from ads-client.
Related Issues (20)
- Read symbol value on BC9050 HOT 2
- MBUS card through ADS HOT 1
- BK9050 HOT 11
- idea: ads-client with Blockly, organization: VisualPLC, problem port 301 without address, HOT 11
- CX9020 HOT 1
- Get events/alarms/messages from TcEventLogger HOT 3
- write variable type BOOL HOT 1
- ads-client+vite+vanillajs it's possible? HOT 5
- Subcribe to variable without PLC port 301 HOT 1
- Version 2 - Missing features from v1 HOT 9
- Version 2 - Adding support for SymbolInfo and DataType extended flags
- Version 2 - Making sure 1.4.2 and 1.4.3 updates are merged HOT 2
- Version 2 - Pull requests
- Version 2 - README
- Version 2 - MIGRATION HOT 1
- Version 2 - Documentation
- Version 2 - Finalizing types HOT 1
- Version 2 - Finalizing testing
- Version 2 - Reconnecting and handling subscriptions during reconnection and symbol version change HOT 1
- Time datatype HOT 2
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 ads-client.