variable substitution in tags logix 5000.

Dreammstr6

Member
Join Date
Apr 2012
Location
Al
Posts
6
Hello all, in the past I have used a tag to represent the array number of a tag which works well. example: Tag1 is an array say 200 elements. and tag2 is a int.. set it up in program such as: Tag1[tag2] if tag2 = 20 then you end up with Tag1[20] in the program but it can change on the fly. this is very handy in alarm scanning or sequencers. my question is. knowing that logix can do some substitution can I take a tag such as grp1_settings and replace the "1" with another int tag? this would be easier then making ladders for all 16 groups and 273 tags per group.. I thought about using arrays for the tags and use the method I know but one snag is the data is coming from opc being exchanged into the plc via software that can't break the array apart. any ideas or suggestion? or is carpal tunnel in my near future? thanks for any advice
 
I have used a tag to represent the array number of a tag which works well. example: Tag1 is an array say 200 elements. and tag2 is a int.. set it up in program such as: Tag1[tag2] if tag2 = 20 then you end up with Tag1[20] in the program but it can change on the fly.
Yes, you can use indirect addressing in Logix.

knowing that logix can do some substitution can I take a tag such as grp1_settings and replace the "1" with another int tag?
Speaking about Logix, that's not possible to do during runtime. In FTV Studio you can do that kind of action using tag placeholders.

this would be easier then making ladders for all 16 groups and 273 tags per group.. I thought about using arrays for the tags and use the method I know but one snag is the data is coming from opc being exchanged into the plc via software that can't break the array apart. any ideas or suggestion?
I don't know what you intend to do but you can copy your array to an intermediate one and do all your logic there. It'd be something like a subroutine with an array as parameter. Or you can use indirect addressing combined with offset.
 
That's what I was afraid of. in my application I have 16 setpoint groups that have 273 tags in each. ie: grp1_temp_sp grp2_temp_sp grp3_temp_sp etc....
then there is a tag that shows which group is active. like GLOBAL_McStpntgrp which is a int (1-16) so basically I have a routine that needs all the active setpoints but it is one of 16 groups and I have to select the currently active group. just looking for an easier way to do it. the processor already has over 7,000 tags. Thanks for the reply.
 
Not sure I'm following exactly but why not just create a UDT with all your setpoint defined and then an array of that type UDT for how ever many different versions you need to store. Then a simple COP statement to copy udt [0] to UDT_active. I use UDTS to define objects like this all the time....my tag database is small to scroll through because of it.
 
robertmee, my problem is I'm having to use a piece of software called softing to take the opc data from the machine and load it into the control logix processor. softing will not allow me to drill down to the elements of the array. so if I try to use softing with an array here is what happens: if I take opc bool tag setpoint1 and try to load it to array setpoint I can not drill down to setpoint[0] my only choice is setpoint (the whole array). so the indirect addressing is out. I can copy the opc data to a matching tag in the plc which is what I'm currently doing. but now I need to make the program recognize which tag is in the active group. 16 groups at 273 tags each. 4,368 tags... I could copy the current tags into the arrays in the plc but that's going to eat up a lot of tags and logic. I'm just trying to see if anyone has a better idea. right now I'm up to 12,298 tags. Thanks for the ideas so far.
 
i have been thinking about creating the arrays and alias them to the actual tags. still would be an extra 273 tags and confusing for some to follow.
 
If I follow you, you're having to create tags in the form of XYZ1, XYZ2, XYZ3, not XYZ[1], XYZ[2], XYZ[3] because your OPC server doesn't allow that. So you'll need 273 XYZs, that the OPC server can write to. Then you want to copy those into a repository of 273 tags in 16 places in CLX?

If the setpoints are of mixed types I would use an array of UDTs. If they are all boolean, then just an array of boolean.

If mixed type, create a UDT of 273 members (caveat, I've never created one that big, so you might break it up by type. Let's say you have 200 boolean and 73 Dints, you could create two members in the UDT of boolean[X] and DINTs[y] to cover yourself).

Once you have this UDT, create two tags of that type UDT. One tag call it OPC_Interface or something that makes sense. The second tag is an array of that UDT[16], call it Storage.

Keep brute force moving your XYZ1 to XYZ273 into the OPC_Interface tag. It would look something like MOV XYZ1 OPC_Interface.XYZ1. Then you can just use a COPY statement to COPY OPC_Interface to Storage[x] where x you are changing 0 to 15.

You'll end up with only two tags in the tag database, OPC_Interface and Storage, plus the 273 tags you have now. Takes the same amount of memory, but you don't have a Tag DB of 4000+ tags.
 
Last edited:
robertmee, interesting plan. you pretty much understand what I'm up against. except right now i have 4,368 tags the opc is writing to. the opc writes all 16 groups of 273 tags to the plc. the opc is coming from a black box read only pain in the......... i have not tried a UDT with softing. let me give that a whirl might just be the ticket. i really appreciate the idea. sometimes an outside opinion is all it takes to find a solution. if nothing else i can cut 272 tags from the plc by using a UDT. oh and they are mixed tags. REAL,DINT,INT. no bools. they send the bools out as a int or dint then you have to extract it. Thanks again.
 
Last edited:
Good luck but if the OPC can't write to SP[1], I'd be surprised if it can do Tag.SP1. Might contact the manuf to see if they have an updated OPC driver. Not being able to write to an array at the least or UDT at most, is pretty crappy.
 
robertmee, Thank you sir. softing is a german software. they have only two ways anything can be done. the german way or the german way..... i don't know why they wouldn't let the software drill down into the array but you can on a UDT array. go figure. but now thanks to you i can turn those 4,368 tags into 1 UDT array tag. This will be easier on the poor maintenance guy who has to work on it at 1am. Thanks again. If you ever have time look up softin opc suite it's a really handy piece of software for moving data in different formats. and the price is reasonable.
 

Similar Topics

I'm upgrading an existing machine with a Honeywell HC900 controller, and I'm trying to do some data processing in the controller. I have variables...
Replies
0
Views
56
dear all.. i am designing the Sea Water Intake pump which the 4 pumps will be operated parallel, and 1 pump will be as stand by pump The pump data...
Replies
3
Views
157
I have a old lathe with a 120 VCA 9.5 AMP motor. Has white, black and red wires. I need to find a way to connect it to a variable speed controler...
Replies
0
Views
96
I am trying to display a variable within a cicode function onto a graphics page. This function queries a SQL database. I can get the value onto a...
Replies
3
Views
287
Hi all. I'm running a VBA code on my FTView which is actually working, but everytime I open the display that calls the VBA code, it throws the...
Replies
28
Views
1,803
Back
Top Bottom