Array of AOI instances, I can't view the instance logic

theColonel26

Lifetime Supporting Member
Join Date
Feb 2014
Location
West Michigan
Posts
785
I have an array of APO instances that I loop through each scan using a jump.


I can see the logic definition of the AOI but there are no instances listed.


here is the loop that executes the AOI. Is there a work around so I can see what is going on in side them?


Studio 5000 Designer 32.02.00, 5069-L310ER Firmware version 32.13



See attached

2020-05-05 21-00-12 CL-CTRLS-VM-ROC.jpg
 
Last edited:
Nope, you're stuck. The editor/viewer doesn't have a way to define the index instance you are interested in and, since you are cycling through them, the data isn't going to make sense.

Since an AOI is intended to be a function that just works before it if sully deployed (kind of like an ADD or a CPT) I would debug using a single instance until you are confident the code works then deploy it like you have now.

I'm not sure if Paullys50's comment was intended to mean don't ever loop or just don't loop until you can see what is going on. But I like the solution. Its nice and compact.

Keith
 
I'm not sure if Paullys50's comment was intended to mean don't ever loop or just don't loop until you can see what is going on. But I like the solution. Its nice and compact.

Keith

If you want to have access to the instance, don't use a loop. Code an exclusive instance of each AOI, problem solved.

I would argue, that if you insist on using a loop to call an AOI, don't use an AOI at all and use a good ol' subroutine for the sake of online editing. I personally don't see any benefit to coding AOIs like this.
 
Originally posted by Paullys50:

I personally don't see any benefit to coding AOIs like this.

Much better data encapsulation and interface.

I don't have an issue with the basic concept. You just need to understand the implications.

And as I have always said with AOI's, I can't remember the last time I had to edit the functionality of a CPT instruction online. If you are making daily edits to an AOI in a production environment you are probably using the wrong tool; that should be a routine. The function you are encapsulating is probably too broad for the intended function of the tool. Now, as many are wont to do, you can argue all day if the intended functionality is what you want. To which I would say I can wish all day that a stone is a brick but, at the end of the day, I still need to use a stone as a stone.

Keith
 
Nope, you're stuck. The editor/viewer doesn't have a way to define the index instance you are interested in and, since you are cycling through them, the data isn't going to make sense.

Keith
really it shouldn't matter that I am looping. All Studio 5000 should do it showing me the memory values of AOIInstance[0] or AOI Instance[8]. I am not reusing the same AOI instances, each one has it's own instance.


not If I executed the same AOI instance 10 times in one scan oh hell yeah there would be no way for Studio 5000 to show me a data contexts. Because the data inside would be changing 10 times a scan.



Having said that you could do and it would be fine in certain circumstances as long as you make it clear that you are hacking a AOI (Function Block) to behave like a Function.


Functions have encapsulated data too, the difference is it is only retained for one execution of said function. Sadly AB is 15 years behind the curve on language features.


I would argue, that if you insist on using a loop to call an AOI, don't use an AOI at all and use a good ol' subroutine for the sake of online editing. I personally don't see any benefit to coding AOIs like this.
The benefits are


  • Data Encapsulation
  • DRY compliant (Don't Repeat Yourself)
  • less labor intensive to maintain
  • no copy paste mistakes, in other words you are guaranteed the same behavior for every instance.
  • Much cleaner

I don't have an issue with the basic concept. You just need to understand the implications.
I do. All AOIs are executed ever scan that is why I am looping, instead of doing a hack where I just do 1 thing per scan... Like what a lot of PLC guys do..... Hello Race Conditions!!!.... ;)


Execution wise this should be no different than if I manually copy and pasted them all in a row.


I guess I will just edit the code to have the loop skip the instance I want to loop in, and then have it execute outside of the loop. I assume I will have to create a new tag for it that is not an array element right?
 
It's just a restriction of Studio 5000. The software doesn't ever check for the value of an index tag, even when offline.

You can see the same issue when you try to monitor an array tag that has an index tag; it just takes you to the tag name without pointing to any specific element.

Of course execution wise it will still function properly so Keith's solution is probably the easiest during development.
 
Fun fact. I found that if I call the a AOI twice using the same instance tag, I get 2 data contexts listed :unsure: that is completely illogical. they point to the same data.




Also as you guys were saying, yes I found out that

if I call aoi_instance[1] I get a data context
if I call aoi_instance[index_tag] I get nothing



lol
 
You are obviously comparing this to something. What is it?

As I said before, if you are using an indexed array as a tag for the AOI instruction data (which is perfectly valid) and given that you only have one window into the process (the AOI online instruction view) you would have to have a way to define what you want to look at if you want the data to make sense. I agree that AB's method of showing NOTHING seems a little interesting but nothing versus indeterminate information doesn't really seem more or less useful. Were you expecting a tabulated view of ALL possible instances?

Originally posted by theColonel26:

if I call aoi_instance[1] I get a data context

Does that surprise you? It is a fixed instance. There is no reason you WOULDN'T be able to get a data context in this case. Were you thinking the issue was that the instance data was part of an array? That isn't the issue. The issue is that the way the code is written (which, I say again, is not a problem) doesn't allow the development system THE WAY IT IS DESIGNED to display a specific instance in a cohesive manner. You would have to be able to tell the "window" (the online AOI view) which instance in the array it should be focused on in order to get reasonable data. The development environment doesn't currently have that capability.

Keith
 
Know it's a bit out of the desired solution but if it comes to it a new subroutine with all of the AOI elements just not scanned be a solution. This is what I had done before in this situation as I had a loop as well and ran into the same issue.

The other thing that I played with was making an additional instance with a new base tag, then using mov commands dump in the inputs from a pointer index referring to the instance you'd like to view.
 
As I said before, if you are using an indexed array as a tag for the AOI instruction data (which is perfectly valid) and given that you only have one window into the process (the AOI online instruction view) you would have to have a way to define what you want to look at if you want the data to make sense. I agree that AB's method of showing NOTHING seems a little interesting but nothing versus indeterminate information doesn't really seem more or less useful. Were you expecting a tabulated view of ALL possible instances?
So lets say I have a array of an AOI type "AOI_A" that is 10 long lets, the instance is called AOI_Inst[].


All data for the AOI instance is stored in AOI_Inst[0], AOI_Inst[1] etc.


AOI_A is a Type it defines how the data is structured and what logic is executed. It doesn't actually contain data values, when ever it appears in ladder or Structure text, you pass it the instance that you want to use, the logic executes, using the values contained in the instance.


If you call an AOI twice in a scan, using the same instance, it uses the same data twice. That is why it makes no sense to see 2 data contexts for the same instance, just because it is called twice. Give that fact it is even more strange that you can't see a data context that is executed dynamically. :unsure:



So there is no technical reason that AB couldn't give you a list of all instances in data context. It seems they just never bothered. Which surprises me very little as they haven't had any new major features in years and years. There sales model is targeted at VPs that have no idea how to use any of there products. So they don't really need to waste money on things like Developers when they can just hire more sales guys. :rolleyes:



Does that surprise you? It is a fixed instance.
Yes, as they are all fixed instances in regards to data,



There is no reason you WOULDN'T be able to get a data context in this case. Were you thinking the issue was that the instance data was part of an array?
Yes, initially



That isn't the issue. The issue is that the way the code is written (which, I say again, is not a problem) doesn't allow the development system THE WAY IT IS DESIGNED to display a specific instance in a cohesive manner. You would have to be able to tell the "window" (the online AOI view) which instance in the array it should be focused on in order to get reasonable data. The development environment doesn't currently have that capability.

Keith
In know I am not arguing that it does, I am saying that it should because it is not really technologically any harder to do it. They just didn't, most likely for reasons I listed above.



You are obviously comparing this to something. What is it?
umm Codesys...? It does this.


It also has Functions, Enums, Inheritance, Interfaces, References, Pointers, Function Block Methods, Multiple Routines in Function Blocks.. etc. You know Computer Science concepts that were developed 40 years ago to make programmers jobs easier. :rolleyes: Also you can pass String and Structs in and out of a Function block by value.... Which is really nice, because InOut doesn't always make sense.


Oh and the execute block that I used in the example is priceless.




Here is a video I just made.
https://drive.google.com/file/d/1ml2st-F9blwdPlpz0usJKp9Xeu7h2ChT/view?usp=sharing
 
Last edited:
Originally posted by theColonel26:

So there is no technical reason that AB couldn't give you a list of all instances in data context.

On that we agree. However, in the end, I still say:

Originally posted by kamenges:

To which I would say I can wish all day that a stone is a brick but, at the end of the day, I still need to use a stone as a stone.

STOP TRYING TO USE AB STUFF AS IF ITS A CODESYS PLATFORM, FOR CRYING OUT LOUD!! The longer you try to drive that square peg into a round hole the more frustrated you will become. Stick with the Codesys stuff. It is certainly more capable from a development standpoint and that is how you are trying to program everything else anyway.

Keith
 
Stick with the Codesys stuff. It is certainly more capable from a development standpoint and that is how you are trying to program everything else anyway.

Keith
Oh I would love to, Nothing would make me happier. Unfortunately most plant support guys are still drinking the AB koolaid, and we have to sell machines. So I am dealing with the cards I am dealt.
 

Similar Topics

Exposing shades of “newbie”…. I haven’t used arrays much, and I think using one for multi-zone temperature control is probably the solution I...
Replies
12
Views
789
Hello, I'm digging all over the internet to find a solution for this but haven't come up with anything yet. We have 3 nearly identical machines...
Replies
2
Views
958
I want to create an AOI to take modbus data and put it together as needed. The data is going to be coming from an RTA gateway and will be 32...
Replies
4
Views
3,560
I'm creating a simple AOI for text display of Valve position feedback. i.e. Open, shut, opening ,closing, alarm etc. I created it a while back...
Replies
7
Views
2,709
Hey guys. I'm hoping you can help me out. I've created an AOI that will convert an array of type SINT, INT, or DINT to a string. I have a large...
Replies
1
Views
2,651
Back
Top Bottom