Closed tdesroches closed 3 years ago
Can you try the latest code from the repo?
Can you show what iris_tags list contains, remember that GetTagList contains program names and other items besides just tags.
The first 4 tags were a REAL, then a BOOL. I think this is the same issue I fixed the other day.
The bool strikes again haha. Yeah you're right that should take care of it.
If it is true in this case, I'll get an update to pypi.
I'm back in the office on Monday, I'll try the repo version and get back to you guys. Thanks
Ok so I did some testing, I found the variable I thought was a BOOL is actually a BOOL Array, my apologies. If I include the BOOL by selecting a single index it works no problem. Is this a bug or is it just that arrays need to be handled seperately? Is there a way to get the tag type when I'm reading the tag?
I figured out how to get the DataType, however the BOOL Array DataType is DWORD, is that expected?
Ok I think this issue can be closed. For anyone else there apparently is no such thing as a BOOL Array in AB. When declaring a BOOL Array in the controller they can only be in increments of 32 BOOL because it seems internally they are arrays of DWORDs. The Array length returned is the number or these DWORDs in the Array. ie a Bool Array of 64 BOOL is a DWORD array of length 2.
Ok so I did some testing, I found the variable I thought was a BOOL is actually a BOOL Array, my apologies. If I include the BOOL by selecting a single index it works no problem. Is this a bug or is it just that arrays need to be handled seperately? Is there a way to get the tag type when I'm reading the tag?
Before we added the Response object, we used to return LgxTag obj now Tag class and that object had DataType.
Am I reading this right @dmroeder? It looks like we're not returning this for the user.
Tag class has a str method but we're not currently returning the Tag object for the user to use it.
@TheFern2 The LgxTag class is only used for GetTagList().
BOOL arrays are the worst. As you discovered @tdesroches, they are not stored in the PLC as BOOL, but 32 bit words. That is the reason why when you create BOOL arrays, you have to create them blocks of 32. You can't create a BOOL array of 16 for example. When I request BOOL[4] for example, I have to send the request with an index of 0, because bool 4 is in the first DWORD. Think of BOOL arrays as an array of DINT's and you are using the individual bits.
A few days ago, I realized that I was not handling the index properly for some time. I believe this to be fix in the latest code here on GH, but it has not been put up on pypi. Try the latest code here, the problem should be resolved.
@dmroeder the tests today were performed with the code from gh and it didn't appear to have any problems reading a single index, I haven't tried the pipy version though.
The version on pypi is the same version you found the issue on. I'll get pypi updated tonight.
The version on pypi is the same version you found the issue on. I'll get pypi updated tonight.
Btw I meant to mention this last time, you can add a batch file or bash file with the deployment pypi command to the repo. And on your machine you can have a .pypirc with your credentials. Just to make it a little easier.
https://dev.to/thefern/package-and-deployment-jh https://github.com/TheFern2/OneDriveIgnore On this repo I have a build and deploy script files.
Thanks for the discussion on BOOL arrays. I almost never use them in PLC programming so I never did much with them in my library, but... I think I need to as this is clearly painful :frowning_face:
Preflight checks
Type of issue
Description of issue
When reading a batch of variables the batch read fails when a BOOL is included. The first 4 variables in the list are REALS the 5th one is a BOOL. If I read the BOOL alone it works, if I read the bool along with any of the others it fails.
Expected behavior
Expected response with tags and values
Actual behavior
Reading generates Attribute Error NoneType AttributeError: 'NoneType' object has no attribute 'group'
Code
Screenshots
Stacktrace
Versions
Include versions to