You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old August 17th, 2018, 12:01 PM   #1
Ed_Pethick
Member
United Kingdom

Ed_Pethick is offline
 
Join Date: Aug 2018
Location: Midlands
Posts: 4
(True) Indirect Addressing in Rockwell Logix

Hi

It may be that I'm calling it the wrong thing, but every time I search for indirect addressing I end up looking at indirect indexing (to my mind) instead.
So, apologies for the bluntness but to try and ensure we're on the same page

I'm not asking about: Array[DINT] stuff

I would like to be able to address the Array as a String (Or similar) as this would make my life vastly simpler (I am aware that I could create a large Array of these strings, look them up and use their position to reference a specific array but this would be very cumbersome and require a lot of manual programming)

What I'd like to do is something like:

Move [Dint] into (String)[0]


So at one point it could be "Move 334 into BiscuitArray[0]" and at another point it could be "Move 663 into "CheeseArray[0]" for e.g. Depending on the Value of the tag giving me the String.


Thanks for reading & in advance for any replies.
Even if the answer is not known if you know that actually I'm looking for something called "x" then that would be much appreciated.

Regards
Ed
  Reply With Quote
Old August 17th, 2018, 12:41 PM   #2
Aardwizz
Member
United Kingdom

Aardwizz is offline
 
Aardwizz's Avatar
 
Join Date: Dec 2017
Location: Swindon
Posts: 198
You want to do WHAT ?!?!

Welcome to the forum!

Quote:
Originally Posted by Ed_Pethick View Post
What I'd like to do is something like:

Move [Dint] into (String)[0]

So at one point it could be "Move 334 into BiscuitArray[0]"
It appears that you are trying to find a PLC equivalent to the VB "Set" function, as in:

Code:
Set myTag = "BiscuitArray"
myTag[0] := 334

If so, then no. There is no way to programatically change a "pointer" ('alias' in RS5K parlance) to a different tag name.

PLCs aren't very good at error handling. They don't have time for it. Every msec counts in some applications. If BiscuitArray[x] is an array of numbers, but CheeseArray[x] was an array of UDTs, the data type mismatch would crash the PLC.

Needless to say, while this is acceptable for a PC with just electronic data to get mangled, it isn't acceptable in a PLC where people and machinery can get mangled.

So every tag is deterministic as to a specific memory location. You can index numerically to a different range, but not go so some wildly different place.

Sorry.
  Reply With Quote
Old August 17th, 2018, 01:17 PM   #3
Ed_Pethick
Member
United Kingdom

Ed_Pethick is offline
 
Join Date: Aug 2018
Location: Midlands
Posts: 4
That's a bummer

Thanks for your speedy reply

I'd like to think that simply crashing the PLC shouldn't end up in anyone getting hurt, if it does my safety probably needs looking at too...

Whilst I was kind of expecting that it wouldn't be standard practice, I don't see why it's uniquely dangerous - after all you could copy between totally incompatible datatypes if you really fancied and it would compile just fine and only fault as you ran it - even something as simple as indexing above an arrays' size will math fault out the PLC and that's allowed.

In my particular case then the PLC is not actually controlling anything, merely parsing data at speed garnered from other PLCs, the loss of this PLC would not immediately stop production, it would just mean that transfers of product stopped happening and so after a period of time some processes would be starved.

Speaking to Rockwell tech support, they seemed to think this should be possible but weren't sure how to do it as it's not part of what they cover. I'm happy to do it in ST if Ladder isn't capable - but yes a dynamic Set instruction is sort of what I'm after.
  Reply With Quote
Old August 17th, 2018, 01:24 PM   #4
GaryS
Member
United States

GaryS is offline
 
GaryS's Avatar
 
Join Date: Aug 2003
Location: Lancaster Pa.
Posts: 783
First you can not copy or move a DINT to a STRING data Type
You need to use the DTOS Function (Dint to String)
All strings are stored as an ASCII array the length of the array is the number of char
the max length is 85
The DTOS function dos the conversion for you.
  Reply With Quote
Old August 17th, 2018, 01:24 PM   #5
Mispeld
Member
United States

Mispeld is offline
 
Mispeld's Avatar
 
Join Date: Feb 2017
Location: VA
Posts: 374
The way I read this, there is a need for a two dimensional array where one dimension is a food type and the other is an (undefined) integer index. One approach would be to create the two dimension integer array, and for every access there would need to be a translation of the food type string to an integer, based on a fixed convention (e.g., Biscuit = 0, Cheese = 1, etc.) Alternatively there could be a single dimension array of a user defined type (UDT) consisting of a string and an integer array. In this case the UDT array would need to be searched for the matching string in order to access the integer array.

If one "dimension" is truly coming from a string, there would need to be some kind of search required for each string-based element access. The number of possible strings, and data access needs would help determine an effective design, and whether additional complexity is warranted (e.g., hashing)
__________________
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge." -Stephen Hawking
  Reply With Quote
Old August 17th, 2018, 02:46 PM   #6
janner_10
Supporting Member
United Kingdom

janner_10 is offline
 
Join Date: Dec 2014
Location: Tewkesbury
Posts: 661
Quote:
Originally Posted by Ed_Pethick View Post

In my particular case then the PLC is not actually controlling anything, merely parsing data at speed garnered from other PLCs
Is a PLC the best choice of hardware for the job in that case?

For just collating and moving about data, would a PC and an OPC server be the better choice?
  Reply With Quote
Old August 17th, 2018, 04:59 PM   #7
JaxGTO
Member
United States

JaxGTO is offline
 
Join Date: Apr 2009
Location: Kalieefornia
Posts: 636
It is possible and very easy to do. Check my thread here:
http://www.plctalk.net/qanda/showthread.php?t=105602


You basically use a MSG instruction to yourself.


Jack.
__________________
I have to use Rockwell Software!
  Reply With Quote
Old August 17th, 2018, 05:12 PM   #8
Mispeld
Member
United States

Mispeld is offline
 
Mispeld's Avatar
 
Join Date: Feb 2017
Location: VA
Posts: 374
Per technote 54960 "Indirect Access to Tag Data addressing in ControlLogix":

"Operation is asynchronous to program scan, via system overhead time-slice."

While this message-based approach is clever, that qualification is a red flag that needs to be carefully considered.
__________________
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge." -Stephen Hawking
  Reply With Quote
Old August 17th, 2018, 06:23 PM   #9
Holmux
Lifetime Supporting Member
Denmark

Holmux is offline
 
Join Date: Oct 2013
Location: Aalborg
Posts: 86
Quote:
Originally Posted by janner_10 View Post
Is a PLC the best choice of hardware for the job in that case?

For just collating and moving about data, would a PC and an OPC server be the better choice?
Must of the PLC's I install are only handling data and have very few IO's, the reason I use PLC's for this job is reliabilit.

I have worked many years as a Oracle DBA, installing systems where we collected all production data into the database and made all merges and data handling there before replying back to the production floor, you have so many layers in this setup that can go wrong.

Since I switched over to use PLC's as my DB's and data handling (dual PLC setup) my systems has become rock solid, never any downtime
  Reply With Quote
Old August 20th, 2018, 03:22 PM   #10
CapinWinky
Member
United States

CapinWinky is offline
 
CapinWinky's Avatar
 
Join Date: Aug 2011
Location: Virginia
Posts: 509
To clarify your question, you're looking for a way to get the value of a process variable by way of a string of that process variable's name. Example, what is the value of "MyTag"?

JaxGTO has the only workable answer by using the MSG instruction and as Mispeld points out, that is processed acyclically, so you will need to monitor for completion before moving onto the next call.

For people looking to solve similar puzzles on other platforms, like Codesys or B&R, you would use a library that provides information on process variables. A function in that library will give you the address of the variable when given the name as a string. You then use a pointer to get the data in that address. In B&R land, that would be PV_xgetadr()
__________________
-----------------------------------------------------
Cycling power is a sign of weakness.
  Reply With Quote
Old August 21st, 2018, 02:59 AM   #11
Ed_Pethick
Member
United Kingdom

Ed_Pethick is offline
 
Join Date: Aug 2018
Location: Midlands
Posts: 4
Quote:
Originally Posted by JaxGTO View Post
It is possible and very easy to do. Check my thread here:
http://www.plctalk.net/qanda/showthread.php?t=105602


You basically use a MSG instruction to yourself.


Jack.
Quote:
Originally Posted by Mispeld View Post
Per technote 54960 "Indirect Access to Tag Data addressing in ControlLogix":

"Operation is asynchronous to program scan, via system overhead time-slice."

While this message-based approach is clever, that qualification is a red flag that needs to be carefully considered.
Absolutely perfect Jack, tested & fully working - thanks! That has saved me weeks of work.
& Also thanks for pointing out the qualification, that could easily have tripped me up but I've covered for it in the program now.


FYI, The reason this is being done in a PLC is exactly the same as Holmux but also political/security - in many enterprises IT control computers and Engineering PLCs, trying to keep both happy when sticking in a small server is excruciatingly painful so it's much easier to add a PLC and use existing connections to DBs rather than add remote computers.
  Reply With Quote
Old September 3rd, 2018, 10:35 AM   #12
Ed_Pethick
Member
United Kingdom

Ed_Pethick is offline
 
Join Date: Aug 2018
Location: Midlands
Posts: 4
Thought I'd just add this info for anyone else who is looking at a similar situation;

If the string used for the remote tag is completely incorrect (Tag doesn't exist) then the message will simply display an error but will not fault the PLC
If the string addresses an array that does exist but of a size that doesn't then it will fault the PLC as normal. I'd suggest putting in some LEQs to catch this before it happens.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
RS Logix 5000 - any benefits of loading off CD or Rockwell Website ? Baker in Virginia LIVE PLC Questions And Answers 2 March 11th, 2017 09:52 AM
Any idea how this works - Indirect Addressing (Rockwell) antsrealm LIVE PLC Questions And Answers 1 January 30th, 2017 08:07 PM
scan question slc 5/03 just the cowboy LIVE PLC Questions And Answers 6 March 27th, 2015 10:27 AM
Indirect addressing - RSLogix 500 doesn't always work wildcatherder LIVE PLC Questions And Answers 23 October 28th, 2009 12:57 PM
Ab Rs Logix Indirect Addressing PERSPOLIS LIVE PLC Questions And Answers 4 December 23rd, 2002 03:33 PM


All times are GMT -5. The time now is 09:43 PM.


.